本文整理汇总了C++中GTK_COMBO_BOX函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_COMBO_BOX函数的具体用法?C++ GTK_COMBO_BOX怎么用?C++ GTK_COMBO_BOX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_COMBO_BOX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gtr_torrent_options_dialog_new
GtkWidget*
gtr_torrent_options_dialog_new( GtkWindow * parent, TrCore * core, tr_ctor * ctor )
{
guint row;
guint col;
const char * str;
GtkWidget * w;
GtkWidget * d;
GtkWidget * t;
GtkWidget * l;
GtkWidget * grab;
GtkWidget * source_chooser;
struct OpenData * data;
bool flag;
GSList * list;
GSList * walk;
/* make the dialog */
d = gtk_dialog_new_with_buttons( _( "Torrent Options" ), parent,
GTK_DIALOG_DESTROY_WITH_PARENT,
NULL );
gtk_dialog_add_button( GTK_DIALOG( d ), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL );
grab = gtk_dialog_add_button( GTK_DIALOG( d ), GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT );
gtk_dialog_set_default_response( GTK_DIALOG( d ),
GTK_RESPONSE_ACCEPT );
gtk_dialog_set_alternative_button_order( GTK_DIALOG( d ),
GTK_RESPONSE_ACCEPT,
GTK_RESPONSE_CANCEL,
-1 );
if( tr_ctorGetDownloadDir( ctor, TR_FORCE, &str ) )
g_assert_not_reached( );
g_assert( str );
data = g_new0( struct OpenData, 1 );
data->core = core;
data->ctor = ctor;
data->filename = g_strdup( tr_ctorGetSourceFile( ctor ) );
data->downloadDir = g_strdup( str );
data->file_list = gtr_file_list_new( core, 0 );
str = _( "Mo_ve .torrent file to the trash" );
data->trash_check = gtk_check_button_new_with_mnemonic( str );
str = _( "_Start when added" );
data->run_check = gtk_check_button_new_with_mnemonic( str );
w = data->priority_combo = gtr_priority_combo_new( );
gtr_priority_combo_set_value( GTK_COMBO_BOX( w ), TR_PRI_NORMAL );
g_signal_connect( G_OBJECT( d ), "response",
G_CALLBACK( addResponseCB ), data );
t = gtk_table_new( 6, 2, FALSE );
gtk_container_set_border_width( GTK_CONTAINER( t ), GUI_PAD_BIG );
gtk_table_set_row_spacings( GTK_TABLE( t ), GUI_PAD );
gtk_table_set_col_spacings( GTK_TABLE( t ), GUI_PAD_BIG );
row = col = 0;
l = gtk_label_new_with_mnemonic( _( "_Torrent file:" ) );
gtk_misc_set_alignment( GTK_MISC( l ), 0.0f, 0.5f );
gtk_table_attach( GTK_TABLE( t ), l, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0 );
++col;
w = gtk_file_chooser_button_new( _( "Select Source File" ),
GTK_FILE_CHOOSER_ACTION_OPEN );
source_chooser = w;
gtk_table_attach( GTK_TABLE( t ), w, col, col + 1, row, row + 1, ~0, 0, 0, 0 );
gtk_label_set_mnemonic_widget( GTK_LABEL( l ), w );
addTorrentFilters( GTK_FILE_CHOOSER( w ) );
g_signal_connect( w, "selection-changed",
G_CALLBACK( sourceChanged ), data );
++row;
col = 0;
l = gtk_label_new_with_mnemonic( _( "_Destination folder:" ) );
gtk_misc_set_alignment( GTK_MISC( l ), 0.0f, 0.5f );
gtk_table_attach( GTK_TABLE( t ), l, col, col + 1, row, row + 1, GTK_FILL, 0, 0, 0 );
++col;
w = gtk_file_chooser_button_new( _( "Select Destination Folder" ),
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER );
if( !gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( w ),
data->downloadDir ) )
g_warning( "couldn't select '%s'", data->downloadDir );
list = get_recent_destinations( );
for( walk = list; walk; walk = walk->next )
gtk_file_chooser_add_shortcut_folder( GTK_FILE_CHOOSER( w ), walk->data, NULL );
g_slist_free( list );
gtk_table_attach( GTK_TABLE( t ), w, col, col + 1, row, row + 1, ~0, 0, 0, 0 );
gtk_label_set_mnemonic_widget( GTK_LABEL( l ), w );
g_signal_connect( w, "selection-changed",
G_CALLBACK( downloadDirChanged ), data );
++row;
col = 0;
w = data->file_list;
gtk_widget_set_size_request ( w, 466u, 300u );
gtk_table_attach_defaults( GTK_TABLE( t ), w, col, col + 2, row, row + 1 );
++row;
col = 0;
w = gtk_label_new_with_mnemonic( _( "Torrent _priority:" ) );
gtk_misc_set_alignment( GTK_MISC( w ), 0.0f, 0.5f );
//.........这里部分代码省略.........
示例2: gtk_widget_set_sensitive
void CExpressDlg::Execute()
{
int res, id;
char msg[256], buf[256];
GtkTreeModel *pList = g_Project->FileList();
GtkTreeIter iter, iter2;
m_Updating = true;
// Default state
GtkTreeSelection *pSel = g_MainWnd->GetSelection();
gtk_widget_set_sensitive(m_SelBtn, gtk_tree_selection_count_selected_rows(pSel)>0);
m_Selected = gtk_tree_selection_count_selected_rows(pSel)>1;
if (m_Selected)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_SelBtn), true);
else
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_AllBtn), true);
// Restore last settings
if (m_ConvertBtn) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_ConvertBtn),
g_Project->GetBool("ExpressReduction", "Convert", true));
CmpackChannel channel = (CmpackChannel)g_Project->GetInt("Convert", "ColorChannel", CMPACK_CHANNEL_DEFAULT);
SelectChannel(channel);
}
if (m_TimeCorrBtn) {
m_TimeCorr = g_Project->GetDbl("TimeCorr", "Seconds", 0);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_TimeCorrBtn),
g_Project->GetBool("ExpressReduction", "TimeCorr", false));
UpdateTimeCorrection();
}
if (m_BiasCorrBtn && m_BiasFrameEdit) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_BiasCorrBtn),
g_Project->GetBool("ExpressReduction", "BiasCorr", false));
char *bias = g_Project->GetStr("BiasCorr", "File", NULL);
if (bias)
gtk_entry_set_text(GTK_ENTRY(m_BiasFrameEdit), bias);
else
gtk_entry_set_text(GTK_ENTRY(m_BiasFrameEdit), "");
g_free(bias);
}
if (m_DarkCorrBtn && m_DarkFrameEdit) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_DarkCorrBtn),
g_Project->GetBool("ExpressReduction", "DarkCorr", false));
char *dark = g_Project->GetStr("DarkCorr", "File", NULL);
if (dark)
gtk_entry_set_text(GTK_ENTRY(m_DarkFrameEdit), dark);
else
gtk_entry_set_text(GTK_ENTRY(m_DarkFrameEdit), "");
g_free(dark);
}
if (m_FlatCorrBtn && m_FlatFrameEdit) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_FlatCorrBtn),
g_Project->GetBool("ExpressReduction", "FlatCorr", false));
char *flat = g_Project->GetStr("FlatCorr", "File", NULL);
if (flat)
gtk_entry_set_text(GTK_ENTRY(m_FlatFrameEdit), flat);
else
gtk_entry_set_text(GTK_ENTRY(m_FlatFrameEdit), "");
g_free(flat);
}
if (m_PhotometryBtn) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_PhotometryBtn),
g_Project->GetBool("ExpressReduction", "Photometry", false));
}
if (m_MatchingBtn && m_RefBtn && m_CatBtn) {
m_Matching = g_Project->GetBool("ExpressReduction", "Matching", false);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_MatchingBtn), m_Matching && !m_Selected);
if (g_Project->GetInt("MatchingDlg", "Select", 0)==0)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_RefBtn), true);
else
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_CatBtn), true);
}
if (m_RefFrameCombo) {
gtk_combo_box_set_model(GTK_COMBO_BOX(m_RefFrameCombo), NULL);
gtk_list_store_clear(m_Frames);
gboolean ok = gtk_tree_model_get_iter_first(pList, &iter);
while (ok) {
gtk_tree_model_get(GTK_TREE_MODEL(pList), &iter, FRAME_ID, &id, -1);
gtk_list_store_append(m_Frames, &iter2);
sprintf(buf, "Frame #%d", id);
gtk_list_store_set(m_Frames, &iter2, 0, id, 1, buf, -1);
ok = gtk_tree_model_iter_next(pList, &iter);
}
gtk_combo_box_set_model(GTK_COMBO_BOX(m_RefFrameCombo), GTK_TREE_MODEL(m_Frames));
SelectRefFrame(g_Project->GetInt("MatchingDlg", "Frame", 0));
if (gtk_combo_box_get_active(GTK_COMBO_BOX(m_RefFrameCombo))<0) {
GtkTreeIter iter3;
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(m_Frames), &iter3))
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(m_RefFrameCombo), &iter3);
}
}
if (m_CatFrameEdit) {
char *path = g_Project->GetStr("MatchingDlg", "File", NULL);
if (path)
gtk_entry_set_text(GTK_ENTRY(m_CatFrameEdit), path);
else
gtk_entry_set_text(GTK_ENTRY(m_CatFrameEdit), "");
g_free(path);
}
//.........这里部分代码省略.........
示例3: return
CmpackChannel CExpressDlg::SelectedChannel(void)
{
if (m_ChannelCombo)
return (CmpackChannel)SelectedItem(GTK_COMBO_BOX(m_ChannelCombo), CMPACK_CHANNEL_DEFAULT);
return CMPACK_CHANNEL_DEFAULT;
}
示例4: on_dlg_response
//.........这里部分代码省略.........
quoted_time,
gstr->str );
}
if ( new_atime )
{
quoted_time = bash_quote( new_atime );
quoted_path = cmd; // temp str
cmd = g_strdup_printf( "%s%stouch --no-dereference --no-create -a -d %s%s",
cmd ? cmd : "",
cmd ? "\n" : "",
quoted_time,
gstr->str );
g_free( quoted_path );
}
g_free( quoted_time );
g_string_free( gstr, TRUE );
if ( cmd )
{
task = ptk_file_exec_new( _("Change File Date"), "/",
GTK_WIDGET( dialog ), NULL );
task->task->exec_command = cmd;
task->task->exec_sync = TRUE;
task->task->exec_export = FALSE;
task->task->exec_show_output = TRUE;
task->task->exec_show_error = TRUE;
ptk_file_task_run( task );
}
}
/* Set default action for mimetype */
GtkWidget* open_with;
if( ( open_with = (GtkWidget*)g_object_get_data( G_OBJECT(dialog), "open_with" ) ) )
{
GtkTreeModel* model = gtk_combo_box_get_model( GTK_COMBO_BOX(open_with) );
GtkTreeIter it;
if( model && gtk_combo_box_get_active_iter( GTK_COMBO_BOX(open_with), &it ) )
{
char* action;
gtk_tree_model_get( model, &it, 2, &action, -1 );
if( action )
{
file = ( VFSFileInfo* ) data->file_list->data;
VFSMimeType* mime = vfs_file_info_get_mime_type( file );
vfs_mime_type_set_default_action( mime, action );
vfs_mime_type_unref( mime );
g_free( action );
}
}
}
/* Check if we need chown */
owner_name = gtk_entry_get_text( data->owner );
if ( owner_name && *owner_name &&
(!data->owner_name || strcmp( owner_name, data->owner_name ) ) )
{
uid = uid_from_name( owner_name );
if ( uid == -1 )
{
ptk_show_error( GTK_WINDOW( dialog ), _("Error"), _( "Invalid User" ) );
return ;
}
}
group_name = gtk_entry_get_text( data->group );
if ( group_name && *group_name &&
(!data->group_name || strcmp( group_name, data->group_name ) ) )
示例5: airpcap_update_channel_offset_combo
/*
* Update the channel offset of the given combobox according to the given frequency.
*/
void
airpcap_update_channel_offset_combo(airpcap_if_info_t* if_info, guint chan_freq, GtkWidget *channel_offset_cb, gboolean set)
{
gint current_offset;
gint new_offset;
guint i;
gint active_idx = 0;
gint idx_count = -1;
if (!if_info || airpcap_if_is_any(if_info) || if_info->pSupportedChannels == NULL || if_info->numSupportedChannels < 1) {
gtk_widget_set_sensitive(GTK_WIDGET(channel_offset_cb),FALSE);
gtk_combo_box_set_active(GTK_COMBO_BOX(channel_offset_cb), -1);
return;
}
new_offset = current_offset = if_info->channelInfo.ExtChannel;
/* Clear out the list */
while (gtk_tree_model_iter_n_children(gtk_combo_box_get_model(GTK_COMBO_BOX(channel_offset_cb)), NULL) > 0) {
gtk_combo_box_text_remove(GTK_COMBO_BOX_TEXT(channel_offset_cb), 0);
}
gtk_widget_set_sensitive(GTK_WIDGET(channel_offset_cb), TRUE);
for (i = 0; i < if_info->numSupportedChannels; i++) {
if (if_info->pSupportedChannels[i].Frequency == chan_freq) {
/* If we can't be low or high, nudge the offset to 0 */
if (current_offset == -1 && !(if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_LOW)) {
new_offset = 0;
} else if (current_offset == 1 && !(if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_HIGH)) {
new_offset = 0;
}
if ((if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_LOW)) {
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(channel_offset_cb), "-1");
idx_count++;
if (new_offset == -1) {
active_idx = idx_count;
}
}
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(channel_offset_cb), "0");
idx_count++;
if (new_offset == 0) {
active_idx = idx_count;
}
if ((if_info->pSupportedChannels[i].Flags & FLAG_CAN_BE_HIGH)){
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(channel_offset_cb), "+1");
idx_count++;
if (new_offset == 1) {
active_idx = idx_count;
}
}
break;
}
}
gtk_combo_box_set_active(GTK_COMBO_BOX(channel_offset_cb), active_idx);
if (set) {
change_airpcap_settings = TRUE;
if_info->channelInfo.ExtChannel = new_offset;
if (!airpcap_update_frequency_and_offset(if_info)){
simple_dialog(ESD_TYPE_ERROR,ESD_BTN_OK,"Adapter failed to be set with the following settings: Frequency - %d Extension Channel - %d", if_info->channelInfo.Frequency, if_info->channelInfo.ExtChannel);
}
}
if (idx_count < 1) {
gtk_widget_set_sensitive(channel_offset_cb, FALSE);
}
}
示例6: behavior
bool XAP_UnixDialog_FileOpenSaveAs::_run_gtk_main(XAP_Frame * pFrame,
GtkWidget * filetypes_pulldown)
{
/*
Run the dialog in a loop to catch bad filenames.
The location of this check being in this dialog loop
could be considered temporary. Doing this matches the Windows
common control behavior (where the dialog checks everything
for the programmer), but lacks flexibility for different
uses of this dialog (file export, print export, directory
(not file) selection).
This check might need to be moved into the ap code which calls
this dialog, and certain interfaces exposed so that the
dialog is displayed throughout the verification.
For right now you can signal this check on and off with
bCheckWritePermission.
*/
char * szDialogFilename = NULL; // this is the file name returned from the dialog
char * szFinalPathname = NULL; // this is the file name after suffix addition, if any
char * szFinalPathnameCopy = NULL; // one to mangle when looking for dirs, etc.
char * pLastSlash;
// if m_bSave is not set, we're looking to OPEN a file.
// otherwise we are looking to SAVE a file.
if (!m_bSave)
{
while (1)
{
gtk_main();
if (m_answer == a_CANCEL) // The easy way out
return false;
m_szFinalPathnameCandidate = gtk_file_chooser_get_uri(m_FC);
UT_ASSERT(m_szFinalPathnameCandidate);
return (m_answer == a_OK);
}
}
else
{
while(1)
{
gtk_main();
if (m_answer == a_CANCEL) // The easy way out
return false;
// Give us a filename we can mangle
szDialogFilename = gtk_file_chooser_get_uri(m_FC);
if (!szDialogFilename)
continue;
// We append the suffix of the default type, so the user doesn't
// have to. This is adapted from the Windows front-end code
// (xap_Win32Dlg_FileOpenSaveAs.cpp), since it should act the same.
// If, however, the user doesn't want suffixes, they don't have to have them.
{
//UT_uint32 end = g_strv_length(m_szSuffixes);
UT_sint32 nFileType = XAP_comboBoxGetActiveInt(GTK_COMBO_BOX(filetypes_pulldown));
// set to first item, which should probably be auto detect
// TODO : "probably" isn't very good.
UT_uint32 nIndex = 0;
// the index in the types table will match the index in the suffix
// table. nFileType is the data we are searching for.
if(m_nTypeList != NULL)
{
for (UT_uint32 i = 0; m_nTypeList[i]; i++)
{
if (m_nTypeList[i] == nFileType)
{
nIndex = i;
break;
}
}
}
bool wantSuffix = true;
XAP_Prefs *pPrefs= XAP_App::getApp()->getPrefs();
pPrefs->getPrefsValueBool(static_cast<const gchar *>(XAP_PREF_KEY_UseSuffix), &wantSuffix);
UT_DEBUGMSG(("UseSuffix: %d\n", wantSuffix));
if (nFileType > 0 && getDialogId() != XAP_DIALOG_ID_FILE_SAVE_IMAGE) // 0 means autodetect
{
if (!UT_pathSuffix(szDialogFilename).empty())
{
// warn if we have a suffix that doesn't match the selected file type
IE_ExpSniffer* pSniffer = IE_Exp::snifferForFileType(m_nTypeList[nIndex]);
if (pSniffer && !pSniffer->recognizeSuffix(UT_pathSuffix(szDialogFilename).c_str()))
{
UT_UTF8String msg;
const XAP_StringSet * pSS = m_pApp->getStringSet();
pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_ExtensionDoesNotMatch, msg);
if (pFrame->showMessageBox(msg.utf8_str(), XAP_Dialog_MessageBox::b_YN, XAP_Dialog_MessageBox::a_NO) != XAP_Dialog_MessageBox::a_YES)
goto ContinueLoop;
}
//.........这里部分代码省略.........
示例7: create_tray_on_screen
static TrayData *
create_tray_on_screen (GdkScreen *screen,
gboolean force)
{
GtkWidget *window, *hbox, *vbox, *button, *combo, *label;
TrayData *data;
n_windows++;
if (!force && na_tray_manager_check_running (screen)) {
GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO,
"Override tray manager?");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"There is already a tray manager running on screen %d.",
gdk_screen_get_number (screen));
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
g_signal_connect (dialog, "response", G_CALLBACK (warning_dialog_response_cb), screen);
gtk_window_present (GTK_WINDOW (dialog));
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) maybe_quit, NULL);
return NULL;
}
data = g_new0 (TrayData, 1);
data->screen = screen;
data->screen_num = gdk_screen_get_number (screen);
data->window = window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_object_weak_ref (G_OBJECT (window), (GWeakNotify) maybe_quit, NULL);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
gtk_container_add (GTK_CONTAINER (window), vbox);
button = gtk_button_new_with_mnemonic ("_Add another tray");
g_signal_connect (button, "clicked", G_CALLBACK (add_tray_cb), data);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
label = gtk_label_new_with_mnemonic ("_Orientation:");
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
combo = gtk_combo_box_text_new ();
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Horizontal");
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Vertical");
g_signal_connect (combo, "changed",
G_CALLBACK (orientation_changed_cb), data);
gtk_box_pack_start (GTK_BOX (hbox), combo, FALSE, FALSE, 0);
label = gtk_label_new (NULL);
data->count_label = GTK_LABEL (label);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
data->tray = na_tray_new_for_screen (screen, GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (data->tray), TRUE, TRUE, 0);
data->box = gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (GTK_BIN (data->tray))));
g_signal_connect_after (data->box, "add", G_CALLBACK (tray_added_cb), data);
g_signal_connect_after (data->box, "remove", G_CALLBACK (tray_removed_cb), data);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_window_set_screen (GTK_WINDOW (window), screen);
gtk_window_set_default_size (GTK_WINDOW (window), -1, 200);
/* gtk_window_set_resizable (GTK_WINDOW (window), FALSE); */
gtk_widget_show_all (window);
update_child_count (data);
return data;
}
示例8: show_preferences_dialog
/**
* Clicked on Preferences in the UI
*/
void show_preferences_dialog (void)
{
static GtkWidget *prefs_dialog = NULL;
if (prefs_dialog) {
gtk_window_present (GTK_WINDOW (prefs_dialog));
} else {
static const gchar *path_key = SJ_SETTINGS_PATH_PATTERN;
static const gchar *file_key = SJ_SETTINGS_FILE_PATTERN;
prefs_dialog = GET_WIDGET ("prefs_dialog");
g_assert (prefs_dialog != NULL);
g_object_add_weak_pointer (G_OBJECT (prefs_dialog), (gpointer)&prefs_dialog);
gtk_window_set_transient_for (GTK_WINDOW (prefs_dialog), GTK_WINDOW (main_window));
cd_option = GET_WIDGET ("cd_option");
basepath_fcb = GET_WIDGET ("path_chooser");
path_option = GET_WIDGET ("path_option");
file_option = GET_WIDGET ("file_option");
profile_option = GET_WIDGET ("profile_option");
check_strip = GET_WIDGET ("check_strip");
check_eject = GET_WIDGET ("check_eject");
check_open = GET_WIDGET ("check_open");
path_example_label = GET_WIDGET ("path_example_label");
sj_add_default_dirs (GTK_FILE_CHOOSER (basepath_fcb));
populate_pattern_combo (GTK_COMBO_BOX (path_option), path_patterns);
/* The gpointer cast is to prevent -Wdiscarded-quantifiers from
producing a warning. This is safe as the string is treated as
const gchar* in the callback. */
g_signal_connect (path_option, "changed",
G_CALLBACK (prefs_pattern_option_changed),
(gpointer) path_key);
populate_pattern_combo (GTK_COMBO_BOX (file_option), (gpointer) file_patterns);
/* The gpointer cast is to prevent -Wdiscarded-quantifiers from
producing a warning. This is safe as the string is treated as
const gchar* in the callback. */
g_signal_connect (file_option, "changed",
G_CALLBACK (prefs_pattern_option_changed),
(gpointer) file_key);
populate_profile_combo (GTK_COMBO_BOX (profile_option));
g_signal_connect (profile_option, "changed", G_CALLBACK (prefs_profile_changed), NULL);
g_signal_connect (cd_option, "drive-changed", G_CALLBACK (prefs_drive_changed), NULL);
/* Connect to GSettings to update the UI */
g_settings_bind (sj_settings, SJ_SETTINGS_EJECT, G_OBJECT (check_eject), "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (sj_settings, SJ_SETTINGS_OPEN, G_OBJECT (check_open), "active", G_SETTINGS_BIND_DEFAULT);
g_settings_bind (sj_settings, SJ_SETTINGS_STRIP, G_OBJECT (check_strip), "active", G_SETTINGS_BIND_DEFAULT);
g_signal_connect (G_OBJECT (sj_settings), "changed::"SJ_SETTINGS_DEVICE,
(GCallback)device_changed_cb, NULL);
g_signal_connect (G_OBJECT (sj_settings), "changed::"SJ_SETTINGS_BASEURI,
(GCallback)baseuri_changed_cb, NULL);
g_signal_connect (G_OBJECT (sj_settings), "changed::"SJ_SETTINGS_AUDIO_PROFILE,
(GCallback)settings_changed_cb, profile_option);
g_signal_connect (G_OBJECT (sj_settings), "changed::"SJ_SETTINGS_PATH_PATTERN,
(GCallback)settings_changed_cb, path_option);
g_signal_connect (G_OBJECT (sj_settings), "changed::"SJ_SETTINGS_FILE_PATTERN,
(GCallback)settings_changed_cb, file_option);
g_signal_connect (G_OBJECT (sj_settings), "changed::"SJ_SETTINGS_STRIP,
(GCallback)strip_changed_cb, NULL);
g_signal_connect (sj_extractor, "notify::profile", pattern_label_update, NULL);
baseuri_changed_cb (sj_settings, SJ_SETTINGS_BASEURI, NULL);
settings_changed_cb (sj_settings, SJ_SETTINGS_AUDIO_PROFILE, profile_option);
settings_changed_cb (sj_settings, SJ_SETTINGS_FILE_PATTERN, file_option);
settings_changed_cb (sj_settings, SJ_SETTINGS_PATH_PATTERN, path_option);
device_changed_cb (sj_settings, SJ_SETTINGS_DEVICE, NULL);
gtk_widget_show_all (prefs_dialog);
}
}
示例9: mud_connections_property_save
static gboolean
mud_connections_property_save(MudConnections *conn)
{
GConfClient *client;
const gchar *name =
gtk_entry_get_text(GTK_ENTRY(conn->priv->name_entry));
const gchar *host =
gtk_entry_get_text(GTK_ENTRY(conn->priv->host_entry));
const gchar *character_name
= gtk_entry_get_text(GTK_ENTRY(conn->priv->character_name_entry));
gchar *logon, *profile, *key, *buf, *char_name,
*stripped_name, *strip_name_new;
GtkTextIter start, end;
GtkTextBuffer *buffer;
GtkTreeIter iter;
GSList *chars, *entry;
buffer =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(conn->priv->logon_textview));
gtk_text_buffer_get_bounds(buffer, &start, &end);
logon = gtk_text_iter_get_text(&start, &end);
if(gtk_combo_box_get_active_iter(
GTK_COMBO_BOX(conn->priv->profile_combo), &iter))
gtk_tree_model_get(
GTK_TREE_MODEL(conn->priv->profile_model),
&iter, 0, &profile, -1);
else
profile = g_strdup("Default");
if(strlen(name) == 0)
{
utils_error_message(conn->priv->properties_window, _("Error"),
"%s", _("No mud name specified."));
if(logon)
g_free(logon);
if(profile)
g_free(profile);
return FALSE;
}
client = gconf_client_get_default();
/* If the user renames the mud we need to
* transfer over the old character information
* and do some cleanup */
if(conn->priv->original_name &&
strcmp(conn->priv->original_name, name) != 0)
{
stripped_name = gconf_escape_key(conn->priv->original_name, -1);
strip_name_new = gconf_escape_key(name, -1);
key = g_strdup_printf("/apps/gnome-mud/muds/%s/characters",
stripped_name);
chars = gconf_client_all_dirs(client, key, NULL);
g_free(key);
for(entry = chars; entry != NULL; entry = g_slist_next(entry))
{
char_name = g_path_get_basename((gchar *)entry->data);
key = g_strdup_printf(
"/apps/gnome-mud/muds/%s/characters/%s/logon",
stripped_name, char_name);
buf = gconf_client_get_string(client, key, NULL);
g_free(key);
key = g_strdup_printf(
"/apps/gnome-mud/muds/%s/characters/%s/logon",
strip_name_new, char_name);
gconf_client_set_string(client, key, buf, NULL);
g_free(key);
g_free(char_name);
g_free(buf);
}
for(entry = chars; entry != NULL; entry = g_slist_next(entry))
if(entry->data)
g_free(entry->data);
g_slist_free(chars);
key = g_strdup_printf(
"/apps/gnome-mud/muds/%s", stripped_name);
gconf_client_recursive_unset(client, key, 0, NULL);
g_free(key);
g_free(stripped_name);
g_free(strip_name_new);
}
stripped_name = gconf_escape_key(name, -1);
key = g_strdup_printf("/apps/gnome-mud/muds/%s/name", stripped_name);
gconf_client_set_string(client, key, name, NULL);
g_free(key);
key = g_strdup_printf("/apps/gnome-mud/muds/%s/host", stripped_name);
//.........这里部分代码省略.........
示例10: main
int main(int argc,char **argv)
{
GtkWidget *win;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *notebook;
GtkWidget *page;
GtkWidget *button;
GtkWidget *api[4];
GtkWidget *box;
GtkWidget *label;
PREData data;
char *name[]={"百度词典:","必应词典:","金山词霸:","有道词典:"};
char *dic[]={"百度词典","必应词典","金山词霸","有道词典"};
int i;
/*设置默认UTF-8编码*/
setlocale(LC_ALL,"");
#ifdef _WIN32
putenv("LANG=zh_CN.UTF-8");
#else
setenv("LANG","zh_CN.UTF-8");
#endif
/*先读取出配置*/
duoyi_read_config(&data.data);
/*默认状态为未更改*/
data.changed=FALSE;
gtk_init(&argc,&argv);
win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(win),"配置");
gtk_window_set_position(GTK_WINDOW(win),GTK_WIN_POS_CENTER);
gtk_window_set_icon_from_file(GTK_WINDOW(win),
"img/64x64/preferences.png",NULL);
gtk_window_set_resizable(GTK_WINDOW(win),FALSE);
g_signal_connect(G_OBJECT(win),"delete-event",
G_CALLBACK(pre_quit),&data);
vbox=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
notebook=gtk_notebook_new();
gtk_container_add(GTK_CONTAINER(win),vbox);
gtk_box_pack_start(GTK_BOX(vbox),notebook,FALSE,FALSE,5);
/*添加常规页*/
page=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
label=gtk_label_new("常规");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label);
/*添加选择字体按钮*/
label=gtk_label_new("选择字体:");
hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
gtk_box_pack_start(GTK_BOX(page),hbox,FALSE,FALSE,20);
gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,20);
if(data.data.font)
button=gtk_font_button_new_with_font(data.data.font);
else
button=gtk_font_button_new();
/*按钮使用字体显示文字*/
gtk_font_button_set_use_font(GTK_FONT_BUTTON(button),TRUE);
gtk_font_button_set_title(GTK_FONT_BUTTON(button),"字体选择");
gtk_box_pack_start(GTK_BOX(hbox),button,TRUE,TRUE,100);
g_signal_connect(G_OBJECT(button),"font-set",
G_CALLBACK(pre_set_font),&data);
/*添加默认词典选择*/
hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
gtk_box_pack_start(GTK_BOX(page),hbox,FALSE,FALSE,20);
label=gtk_label_new("默认词典:");
gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,20);
box=gtk_combo_box_text_new();
for(i=0;i != 4;++i)
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(box),dic[i]);
gtk_combo_box_set_active(GTK_COMBO_BOX(box),data.data.dic);
g_signal_connect(G_OBJECT(box),"changed",
G_CALLBACK(pre_set_default_dic),&data);
//gtk_combo_box_set_active(GTK_COMBO_BOX(box),data.data.dic);
gtk_box_pack_start(GTK_BOX(hbox),box,TRUE,TRUE,100);
/*添加API页*/
page=gtk_box_new(GTK_ORIENTATION_VERTICAL,0);
label=gtk_label_new("API");
gtk_notebook_append_page(GTK_NOTEBOOK(notebook),page,label);
for(i=0;i != 4;++i)
{
/*名称*/
label=gtk_label_new(name[i]);
/*api输入框*/
api[i]=gtk_entry_new();
/*api*/
data.api[i]=api[i];
/*如果当前API已设置,则显示出来*/
if(data.data.api[i])
gtk_entry_set_text(GTK_ENTRY(api[i]),data.data.api[i]);
hbox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
gtk_box_pack_start(GTK_BOX(page),hbox,TRUE,TRUE,10);
gtk_box_pack_start(GTK_BOX(hbox),label,TRUE,TRUE,10);
gtk_box_pack_start(GTK_BOX(hbox),api[i],TRUE,TRUE,10);
/*如有改动更改操作状态*/
g_signal_connect(G_OBJECT(api[i]),"changed",
//.........这里部分代码省略.........
示例11: gui_init
void gui_init(dt_lib_module_t *self)
{
GtkBox *hbox;
GtkWidget *button;
GtkWidget *label;
GtkEntryCompletion *completion;
dt_lib_metadata_t *d = (dt_lib_metadata_t *)calloc(1, sizeof(dt_lib_metadata_t));
self->data = (void *)d;
d->imgsel = -1;
self->widget = gtk_table_new(6, 2, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(self->widget), 5);
g_signal_connect(self->widget, "expose-event", G_CALLBACK(expose), self);
label = gtk_label_new(_("title"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
d->title = GTK_COMBO_BOX(gtk_combo_box_text_new_with_entry());
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->title))));
completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->title)));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_completion_set_inline_completion(completion, TRUE);
gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->title))), completion);
g_signal_connect (GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->title))), "key-press-event", G_CALLBACK (key_pressed), self);
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->title), 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
label = gtk_label_new(_("description"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
d->description = GTK_COMBO_BOX(gtk_combo_box_text_new_with_entry());
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->description))));
completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->description)));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_completion_set_inline_completion(completion, TRUE);
gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->description))), completion);
g_signal_connect (GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->description))), "key-press-event", G_CALLBACK (key_pressed), self);
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->description), 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
label = gtk_label_new(_("creator"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
d->creator = GTK_COMBO_BOX(gtk_combo_box_text_new_with_entry());
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->creator))));
completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->creator)));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_completion_set_inline_completion(completion, TRUE);
gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->creator))), completion);
g_signal_connect (GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->creator))), "key-press-event", G_CALLBACK (key_pressed), self);
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->creator), 1, 2, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
label = gtk_label_new(_("publisher"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 3, 4, GTK_EXPAND|GTK_FILL, 0, 0, 0);
d->publisher = GTK_COMBO_BOX(gtk_combo_box_text_new_with_entry());
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->publisher))));
completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->publisher)));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_completion_set_inline_completion(completion, TRUE);
gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->publisher))), completion);
g_signal_connect (GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->publisher))), "key-press-event", G_CALLBACK (key_pressed), self);
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->publisher), 1, 2, 3, 4, GTK_EXPAND|GTK_FILL, 0, 0, 0);
label = gtk_label_new(_("rights"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 4, 5, GTK_EXPAND|GTK_FILL, 0, 0, 0);
d->rights = GTK_COMBO_BOX(gtk_combo_box_text_new_with_entry());
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->rights))));
completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, gtk_combo_box_get_model(GTK_COMBO_BOX(d->rights)));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_completion_set_inline_completion(completion, TRUE);
gtk_entry_set_completion(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(d->rights))), completion);
g_signal_connect (GTK_WIDGET(gtk_bin_get_child(GTK_BIN(d->rights))), "key-press-event", G_CALLBACK (key_pressed), self);
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->rights), 1, 2, 4, 5, GTK_EXPAND|GTK_FILL, 0, 0, 0);
g_object_unref(completion);
// reset/apply buttons
hbox = GTK_BOX(gtk_hbox_new(TRUE, 5));
button = gtk_button_new_with_label(_("clear"));
d->clear_button = button;
g_object_set(G_OBJECT(button), "tooltip-text", _("remove metadata from selected images"), (char *)NULL);
gtk_box_pack_start(hbox, button, FALSE, TRUE, 0);
g_signal_connect(G_OBJECT (button), "clicked",
G_CALLBACK (clear_button_clicked), (gpointer)self);
button = gtk_button_new_with_label(_("apply"));
d->apply_button = button;
g_object_set(G_OBJECT(button), "tooltip-text", _("write metadata for selected images"), (char *)NULL);
g_signal_connect(G_OBJECT (button), "clicked",
G_CALLBACK (apply_button_clicked), (gpointer)self);
gtk_box_pack_start(hbox, button, FALSE, TRUE, 0);
//.........这里部分代码省略.........
示例12: sample_config_update
static void
sample_config_update(SooshiState *state, SooshiNode *node, gpointer user_data)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(user_data), g_variant_get_byte(node->value));
}
示例13: main
int main(int argc, char *argv[])
{
GtkBuilder *builder;
gtk_init(&argc, &argv);
builder = gtk_builder_new();
GError *error = NULL;
gtk_builder_add_from_file(builder, "src/ui/mainwindow.glade", &error);
if (error != NULL)
{
printf("Error loading user interface: %s", error->message);
g_error_free(error);
return 0;
}
sooshi_error_t sooshi_error = 0;
SooshiState *state = sooshi_state_new(&sooshi_error);
if (sooshi_error)
return -1;
AppState *s = g_new0(AppState, 1);
s->channel1_top = gtk_builder_get_object(builder, "channel1_top");
s->channel1 = gtk_builder_get_object(builder, "channel1");
s->channel1_bottom = gtk_builder_get_object(builder, "channel1_bottom");
s->channel2_top = gtk_builder_get_object(builder, "channel2_top");
s->channel2 = gtk_builder_get_object(builder, "channel2");
s->channel2_bottom = gtk_builder_get_object(builder, "channel2_bottom");
s->battery_level = gtk_builder_get_object(builder, "battery_level");
s->battery_level_str = gtk_builder_get_object(builder, "battery_level_str");
s->trigger = GTK_COMBO_BOX(gtk_builder_get_object(builder, "Trigger"));
s->sample_rate = GTK_COMBO_BOX(gtk_builder_get_object(builder, "Sample Rate"));
s->sample_depth = GTK_COMBO_BOX(gtk_builder_get_object(builder, "Sample Depth"));
s->sooshi = state;
GObject *window = gtk_builder_get_object(builder, "MainWindow");
g_signal_connect(window, "destroy", G_CALLBACK(app_shutdown), s);
/* Set up CSS style provider */
GtkCssProvider *provider = gtk_css_provider_new();
GdkDisplay *display = gdk_display_get_default();
GdkScreen *screen = gdk_display_get_default_screen(display);
gtk_style_context_add_provider_for_screen(screen,
GTK_STYLE_PROVIDER(provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
gtk_css_provider_load_from_path(GTK_CSS_PROVIDER(provider),
"src/ui/style.css", &error);
if (error != NULL)
{
printf("Error loading user interface style: %s", error->message);
g_error_free(error);
return 0;
}
g_object_unref(provider);
sooshi_setup(state,
mooshi_initialized, s,
mooshi_scan_timed_out, s
);
gtk_widget_show_all(GTK_WIDGET(window));
gtk_main();
sooshi_state_delete(state);
return 0;
}
示例14: create_proc_tab
static void
create_proc_tab(GtkWidget *tab_vbox)
{
GtkWidget *tabs, *table, *vbox, *vbox1, *hbox, *text, *label;
gint i;
tabs = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(tabs), GTK_POS_TOP);
gtk_box_pack_start(GTK_BOX(tab_vbox), tabs, TRUE, TRUE, 0);
/* ---Options tab */
vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Options"));
gkrellm_gtk_check_button_connected(vbox, NULL,
proc.enabled, FALSE, FALSE, 4,
cb_enable, NULL,
_("Enable Proc chart"));
if (gkrellm_sensors_available())
gkrellm_gtk_check_button_connected(vbox, NULL,
sensor_separate_mode, FALSE, FALSE, 0,
cb_sensor_separate, NULL,
_("Draw fan and temperature values separately (not alternating)."));
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, TRUE, 5);
gkrellm_gtk_alert_button(hbox, &processes_alert_button, FALSE, FALSE, 4,
TRUE, cb_processes_alert, NULL);
label = gtk_label_new(_("Processes"));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 4);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, TRUE, 5);
gkrellm_gtk_alert_button(hbox, &users_alert_button, FALSE, FALSE, 4, TRUE,
cb_users_alert, NULL);
label = gtk_label_new(_("Users"));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 4);
hbox = gtk_hbox_new(FALSE, 0);
gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, TRUE, 5);
gkrellm_gtk_alert_button(hbox, &load_alert_button, FALSE, FALSE, 4, TRUE,
cb_load_alert, NULL);
label = gtk_label_new(_("Load"));
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 4);
if (!proc.enabled)
{
gtk_widget_set_sensitive(load_alert_button, FALSE);
gtk_widget_set_sensitive(users_alert_button, FALSE);
gtk_widget_set_sensitive(processes_alert_button, FALSE);
}
vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Setup"));
vbox1 = gkrellm_gtk_category_vbox(vbox,
_("Format String for Chart Labels"),
4, 0, TRUE);
text_format_combo_box = gtk_combo_box_entry_new_text();
gtk_widget_set_size_request (GTK_WIDGET(text_format_combo_box), 350, -1);
gtk_box_pack_start(GTK_BOX(vbox1), text_format_combo_box, FALSE, FALSE, 2);
gtk_combo_box_append_text(GTK_COMBO_BOX(text_format_combo_box), text_format);
gtk_combo_box_append_text(GTK_COMBO_BOX(text_format_combo_box),
_(DEFAULT_TEXT_FORMAT));
gtk_combo_box_append_text(GTK_COMBO_BOX(text_format_combo_box),
_("\\f$L\\r\\f$F \\w88\\b\\p\\a$p\\f procs\\n\\e$u\\f users"));
gtk_combo_box_set_active(GTK_COMBO_BOX(text_format_combo_box), 0);
g_signal_connect(G_OBJECT(GTK_COMBO_BOX(text_format_combo_box)), "changed",
G_CALLBACK(cb_text_format), NULL);
vbox1 = gkrellm_gtk_category_vbox(vbox,
_("Launch Commands"),
4, 0, TRUE);
table = gkrellm_gtk_launcher_table_new(vbox1, 1);
gkrellm_gtk_config_launcher(table, 0,
&proc_launch_entry, &proc_tooltip_entry,
_("Proc"), &proc_launch);
g_signal_connect(G_OBJECT(proc_launch_entry), "changed",
G_CALLBACK(cb_launch_entry), NULL);
g_signal_connect(G_OBJECT(proc_tooltip_entry), "changed",
G_CALLBACK(cb_launch_entry), NULL);
/* --Info tab */
vbox = gkrellm_gtk_framed_notebook_page(tabs, _("Info"));
text = gkrellm_gtk_scrolled_text_view(vbox, NULL,
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
for (i = 0; i < sizeof(proc_info_text)/sizeof(gchar *); ++i)
gkrellm_gtk_text_view_append(text, _(proc_info_text[i]));
}
示例15: on_gesture_end
static void on_gesture_end(ClutterGestureAction *action, ClutterActor *stage, gpointer data) {
ClutterActor *new_actor, *texture, *actor;
gfloat x, y, w, h;
GError *error = NULL;
GdkColor color;
guint16 alpha;
gint iw = 125;
gint ih = 126;
gboolean repeat_x = FALSE;
gboolean repeat_y = TRUE;
guint bgr;
new_actor = tmpRect;
gtk_color_button_get_color(GTK_COLOR_BUTTON(app.colorpicker), &color);
alpha = gtk_color_button_get_alpha(GTK_COLOR_BUTTON(app.colorpicker));
ClutterColor col = {
CLAMP(((color.red / 65535.0) * 255), 0, 255),
CLAMP(((color.green / 65535.0) * 255), 0, 255),
CLAMP(((color.blue / 65535.0) * 255), 0, 255),
CLAMP(((alpha / 65535.0) * 255), 0, 255),
};
clutter_rectangle_set_color(CLUTTER_RECTANGLE(new_actor), &col);
clutter_rectangle_set_border_width(CLUTTER_RECTANGLE(new_actor), 0);
tmpRect = NULL;
clutter_actor_get_position(new_actor, &x, &y);
clutter_actor_get_size(new_actor, &w, &h);
if (background_image_file != NULL){
texture = clutter_texture_new_from_file(background_image_file, &error);
if (error != NULL){
g_print("Loading image failed\n");
g_error_free(error);
}
clutter_actor_set_position(texture, x, y);
clutter_actor_set_size(texture, w, h);
clutter_actor_add_child(stage, texture);
clutter_actor_show(texture);
bgr = gtk_combo_box_get_active(GTK_COMBO_BOX(app.background_repeat_select));
switch (bgr){
case 0:
repeat_x = repeat_y = FALSE;
break;
case 1:
repeat_x = TRUE; repeat_y = FALSE;
break;
case 2:
repeat_x = FALSE; repeat_y = TRUE;
break;
case 3:
repeat_x = repeat_y = TRUE;
break;
}
clutter_texture_get_base_size(CLUTTER_TEXTURE(texture), &iw, &ih);
clutter_actor_set_clip(texture, 0, 0, repeat_x ? w : iw, repeat_y ? h : ih);
clutter_texture_set_sync_size(CLUTTER_TEXTURE(texture), TRUE);
clutter_texture_set_repeat(CLUTTER_TEXTURE(texture), TRUE, TRUE);
clutter_texture_set_keep_aspect_ratio(CLUTTER_TEXTURE(texture), TRUE);
actor = texture;
clutter_actor_destroy(new_actor);
}
else {
actor = new_actor;
}
tool = TOOL_SELECT;
clutter_actor_add_action(actor, clutter_drag_action_new());
clutter_actor_set_reactive(actor, TRUE);
actors = g_list_append(actors, actor);
GdkWindow *gdk_window;
gdk_window = gtk_widget_get_window(app.stage);
gdk_window_set_cursor(gdk_window, NULL);
}