本文整理汇总了C++中G_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ G_OBJECT函数的具体用法?C++ G_OBJECT怎么用?C++ G_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_OBJECT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: create_bookmarks_window
/**
* create_bookmarks_window:
*
* Create a new bookmark-editing window.
* @list: The NautilusBookmarkList that this window will edit.
*
* Return value: A pointer to the new window.
**/
GtkWindow *
create_bookmarks_window (NautilusBookmarkList *list, GObject *undo_manager_source)
{
GtkWidget *window;
GtkTreeViewColumn *col;
GtkCellRenderer *rend;
GladeXML *gui;
bookmarks = list;
gui = eel_glade_get_file (GLADEDIR "/nautilus-bookmarks-window.glade",
NULL, NULL,
"bookmarks_dialog", &window,
"bookmark_tree_view", &bookmark_list_widget,
"bookmark_delete_button", &remove_button,
"bookmark_jump_button", &jump_button,
NULL);
if (!gui) {
return NULL;
}
application = NAUTILUS_WINDOW (undo_manager_source)->application;
if (NAUTILUS_IS_NAVIGATION_WINDOW (undo_manager_source)) {
parent_is_browser_window = TRUE;
} else {
parent_is_browser_window = FALSE;
}
set_up_close_accelerator (window);
nautilus_undo_share_undo_manager (G_OBJECT (window), undo_manager_source);
gtk_window_set_wmclass (GTK_WINDOW (window), "bookmarks", "Nautilus");
nautilus_bookmarks_window_restore_geometry (window);
g_object_weak_ref (G_OBJECT (undo_manager_source), edit_bookmarks_dialog_reset_signals,
undo_manager_source);
bookmark_list_widget = GTK_TREE_VIEW (glade_xml_get_widget (gui, "bookmark_tree_view"));
rend = gtk_cell_renderer_pixbuf_new ();
col = gtk_tree_view_column_new_with_attributes ("Icon",
rend,
"pixbuf",
BOOKMARK_LIST_COLUMN_ICON,
NULL);
gtk_tree_view_append_column (bookmark_list_widget,
GTK_TREE_VIEW_COLUMN (col));
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (col),
NAUTILUS_ICON_SIZE_SMALLER);
rend = gtk_cell_renderer_text_new ();
col = gtk_tree_view_column_new_with_attributes ("Icon",
rend,
"text",
BOOKMARK_LIST_COLUMN_NAME,
"style",
BOOKMARK_LIST_COLUMN_STYLE,
NULL);
gtk_tree_view_append_column (bookmark_list_widget,
GTK_TREE_VIEW_COLUMN (col));
bookmark_list_store = create_bookmark_store ();
setup_empty_list ();
gtk_tree_view_set_model (bookmark_list_widget,
GTK_TREE_MODEL (bookmark_empty_list_store));
bookmark_selection =
GTK_TREE_SELECTION (gtk_tree_view_get_selection (bookmark_list_widget));
name_field = nautilus_entry_new ();
gtk_widget_show (name_field);
gtk_box_pack_start (GTK_BOX (glade_xml_get_widget (gui, "bookmark_name_placeholder")),
name_field, TRUE, TRUE, 0);
nautilus_undo_editable_set_undo_key (GTK_EDITABLE (name_field), TRUE);
gtk_label_set_mnemonic_widget (
GTK_LABEL (glade_xml_get_widget (gui, "bookmark_name_label")),
name_field);
uri_field = nautilus_entry_new ();
gtk_widget_show (uri_field);
gtk_box_pack_start (GTK_BOX (glade_xml_get_widget (gui, "bookmark_location_placeholder")),
uri_field, TRUE, TRUE, 0);
nautilus_undo_editable_set_undo_key (GTK_EDITABLE (uri_field), TRUE);
gtk_label_set_mnemonic_widget (
GTK_LABEL (glade_xml_get_widget (gui, "bookmark_location_label")),
uri_field);
bookmark_list_changed_signal_id =
//.........这里部分代码省略.........
开发者ID:Spheerys,项目名称:nautilus,代码行数:101,代码来源:nautilus-bookmarks-window.c
示例2: plug_in_icc_profile_apply_rgb
gboolean
plug_in_icc_profile_apply_rgb (GimpImage *image,
GimpContext *context,
GimpProgress *progress,
GimpRunMode run_mode,
GError **error)
{
Gimp *gimp;
GimpProcedure *procedure;
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
gimp = image->gimp;
if (gimp_image_get_base_type (image) == GIMP_GRAY)
{
g_set_error (error, GIMP_PLUG_IN_ERROR, GIMP_PLUG_IN_EXECUTION_FAILED,
_("Can't apply color profile to grayscale image (%s)"),
ICC_PROFILE_APPLY_RGB_PROC);
return FALSE;
}
procedure = gimp_pdb_lookup_procedure (gimp->pdb, ICC_PROFILE_APPLY_RGB_PROC);
if (procedure &&
procedure->num_args >= 2 &&
GIMP_IS_PARAM_SPEC_INT32 (procedure->args[0]) &&
GIMP_IS_PARAM_SPEC_IMAGE_ID (procedure->args[1]))
{
GimpValueArray *return_vals;
GimpPDBStatusType status;
GimpColorProfilePolicy policy = GIMP_COLOR_PROFILE_POLICY_ASK;
gboolean success;
return_vals =
gimp_pdb_execute_procedure_by_name (gimp->pdb, context, progress, error,
ICC_PROFILE_APPLY_RGB_PROC,
GIMP_TYPE_INT32, run_mode,
GIMP_TYPE_IMAGE_ID,
gimp_image_get_ID (image),
G_TYPE_NONE);
status = g_value_get_enum (gimp_value_array_index (return_vals, 0));
switch (status)
{
case GIMP_PDB_SUCCESS:
policy = GIMP_COLOR_PROFILE_POLICY_CONVERT;
success = TRUE;
break;
case GIMP_PDB_CANCEL:
policy = GIMP_COLOR_PROFILE_POLICY_KEEP;
success = TRUE;
break;
default:
if (error && *error == NULL)
g_set_error (error,
GIMP_PLUG_IN_ERROR, GIMP_PLUG_IN_EXECUTION_FAILED,
_("Error running '%s'"), ICC_PROFILE_APPLY_RGB_PROC);
success = FALSE;
break;
}
if (success && gimp_value_array_length (return_vals) > 1)
{
GValue *value = gimp_value_array_index (return_vals, 1);
if (GIMP_VALUE_HOLDS_INT32 (value) && g_value_get_int (value))
{
g_object_set (G_OBJECT (gimp->config),
"color-profile-policy", policy,
NULL);
}
}
gimp_value_array_unref (return_vals);
return success;
}
g_set_error (error,
GIMP_PLUG_IN_ERROR, GIMP_PLUG_IN_NOT_FOUND,
_("Plug-In missing (%s)"), ICC_PROFILE_APPLY_RGB_PROC);
return FALSE;
}
开发者ID:ChristianBusch,项目名称:gimp,代码行数:91,代码来源:plug-in-icc-profile.c
示例3: gst_udpsrc_open
/* create a socket for sending to remote machine */
static gboolean
gst_udpsrc_open (GstUDPSrc * src)
{
GInetAddress *addr, *bind_addr;
GSocketAddress *bind_saddr;
GError *err = NULL;
gst_udpsrc_create_cancellable (src);
if (src->socket == NULL) {
/* need to allocate a socket */
GST_DEBUG_OBJECT (src, "allocating socket for %s:%d", src->address,
src->port);
addr = gst_udpsrc_resolve (src, src->address);
if (!addr)
goto name_resolve;
if ((src->used_socket =
g_socket_new (g_inet_address_get_family (addr),
G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_UDP, &err)) == NULL)
goto no_socket;
src->external_socket = FALSE;
GST_DEBUG_OBJECT (src, "got socket %p", src->used_socket);
if (src->addr)
g_object_unref (src->addr);
src->addr =
G_INET_SOCKET_ADDRESS (g_inet_socket_address_new (addr, src->port));
GST_DEBUG_OBJECT (src, "binding on port %d", src->port);
/* On Windows it's not possible to bind to a multicast address
* but the OS will make sure to filter out all packets that
* arrive not for the multicast address the socket joined.
*
* On Linux and others it is necessary to bind to a multicast
* address to let the OS filter out all packets that are received
* on the same port but for different addresses than the multicast
* address
*/
#ifdef G_OS_WIN32
if (g_inet_address_get_is_multicast (addr))
bind_addr = g_inet_address_new_any (g_inet_address_get_family (addr));
else
#endif
bind_addr = G_INET_ADDRESS (g_object_ref (addr));
g_object_unref (addr);
bind_saddr = g_inet_socket_address_new (bind_addr, src->port);
g_object_unref (bind_addr);
if (!g_socket_bind (src->used_socket, bind_saddr, src->reuse, &err))
goto bind_error;
g_object_unref (bind_saddr);
g_socket_set_multicast_loopback (src->used_socket, src->loop);
} else {
GInetSocketAddress *local_addr;
GST_DEBUG_OBJECT (src, "using provided socket %p", src->socket);
/* we use the configured socket, try to get some info about it */
src->used_socket = G_SOCKET (g_object_ref (src->socket));
src->external_socket = TRUE;
local_addr =
G_INET_SOCKET_ADDRESS (g_socket_get_local_address (src->used_socket,
&err));
if (!local_addr)
goto getsockname_error;
/* See above for the reasons. Without this we would behave different on
* Windows and Linux, joining multicast groups below for provided sockets
* on Linux but not on Windows
*/
#ifdef G_OS_WIN32
addr = gst_udpsrc_resolve (src, src->address);
if (!addr)
goto name_resolve;
if (!src->auto_multicast ||
!g_inet_address_get_is_any (g_inet_socket_address_get_address
(local_addr))
|| !g_inet_address_get_is_multicast (addr)) {
g_object_unref (addr);
#endif
if (src->addr)
g_object_unref (src->addr);
src->addr = local_addr;
#ifdef G_OS_WIN32
} else {
g_object_unref (local_addr);
if (src->addr)
g_object_unref (src->addr);
src->addr =
G_INET_SOCKET_ADDRESS (g_inet_socket_address_new (addr, src->port));
g_object_unref (addr);
//.........这里部分代码省略.........
开发者ID:fanc999,项目名称:gst-plugins-good,代码行数:101,代码来源:gstudpsrc.c
示例4: gimp_text_options_gui
GtkWidget *
gimp_text_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GimpTextOptions *options = GIMP_TEXT_OPTIONS (tool_options);
GtkWidget *main_vbox = gimp_tool_options_gui (tool_options);
GtkWidget *table;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *entry;
GtkWidget *box;
GtkWidget *spinbutton;
GtkWidget *combo;
GtkSizeGroup *size_group;
gint row = 0;
hbox = gimp_prop_font_box_new (NULL, GIMP_CONTEXT (tool_options),
_("Font"), 2,
"font-view-type", "font-view-size");
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
entry = gimp_prop_size_entry_new (config,
"font-size", FALSE, "font-size-unit", "%p",
GIMP_SIZE_ENTRY_UPDATE_SIZE, 72.0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Size:"), 0.0, 0.5,
entry, 2, FALSE);
options->size_entry = entry;
vbox = gtk_vbox_new (FALSE, 2);
gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0);
gtk_widget_show (vbox);
button = gimp_prop_check_button_new (config, "use-editor", _("Use editor"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
button = gimp_prop_check_button_new (config, "antialias", _("Antialiasing"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
table = gtk_table_new (6, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_box_pack_start (GTK_BOX (main_vbox), table, FALSE, FALSE, 0);
gtk_widget_show (table);
row = 0;
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
button = gimp_prop_enum_combo_box_new (config, "hint-style", -1, -1);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Hinting:"), 0.0, 0.5,
button, 1, TRUE);
gtk_size_group_add_widget (size_group, button);
button = gimp_prop_color_button_new (config, "foreground", _("Text Color"),
40, 24, GIMP_COLOR_AREA_FLAT);
gimp_color_panel_set_context (GIMP_COLOR_PANEL (button),
GIMP_CONTEXT (options));
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Color:"), 0.0, 0.5,
button, 1, TRUE);
gtk_size_group_add_widget (size_group, button);
box = gimp_prop_enum_stock_box_new (config, "justify", "gtk-justify", 0, 0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
_("Justify:"), 0.0, 0.5,
box, 2, TRUE);
gtk_size_group_add_widget (size_group, box);
g_object_unref (size_group);
spinbutton = gimp_prop_spin_button_new (config, "indent", 1.0, 10.0, 1);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
gimp_table_attach_stock (GTK_TABLE (table), row++,
GTK_STOCK_INDENT, spinbutton, 1, TRUE);
spinbutton = gimp_prop_spin_button_new (config, "line-spacing", 1.0, 10.0, 1);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
gimp_table_attach_stock (GTK_TABLE (table), row++,
GIMP_STOCK_LINE_SPACING, spinbutton, 1, TRUE);
spinbutton = gimp_prop_spin_button_new (config,
"letter-spacing", 1.0, 10.0, 1);
gtk_entry_set_width_chars (GTK_ENTRY (spinbutton), 5);
gimp_table_attach_stock (GTK_TABLE (table), row++,
GIMP_STOCK_LETTER_SPACING, spinbutton, 1, TRUE);
combo = gimp_prop_enum_combo_box_new (config, "box-mode", 0, 0);
gimp_table_attach_aligned (GTK_TABLE (table), 0, row++,
//.........这里部分代码省略.........
开发者ID:WilfR,项目名称:Gimp-Matting,代码行数:101,代码来源:gimptextoptions.c
示例5: stickynotes_applet_init_prefs
void stickynotes_applet_init_prefs(void)
{
stickynotes->builder = gtk_builder_new ();
gtk_builder_add_from_file (stickynotes->builder, BUILDER_PATH, NULL);
stickynotes->w_prefs = GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
"preferences_dialog"));
stickynotes->w_prefs_width = gtk_spin_button_get_adjustment (
GTK_SPIN_BUTTON (gtk_builder_get_object (
stickynotes->builder, "width_spin")));
stickynotes->w_prefs_height = gtk_spin_button_get_adjustment (
GTK_SPIN_BUTTON (gtk_builder_get_object (
stickynotes->builder, "height_spin")));
stickynotes->w_prefs_color = GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
"default_color"));
stickynotes->w_prefs_font_color = GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
"prefs_font_color"));
stickynotes->w_prefs_sys_color = GTK_WIDGET (>K_CHECK_BUTTON (
gtk_builder_get_object (stickynotes->builder,
"sys_color_check"))->toggle_button);
stickynotes->w_prefs_font = GTK_WIDGET (gtk_builder_get_object (stickynotes->builder,
"default_font"));
stickynotes->w_prefs_sys_font = GTK_WIDGET (>K_CHECK_BUTTON (
gtk_builder_get_object (stickynotes->builder,
"sys_font_check"))->toggle_button);
stickynotes->w_prefs_sticky = GTK_WIDGET (>K_CHECK_BUTTON (
gtk_builder_get_object (stickynotes->builder,
"sticky_check"))->toggle_button);
stickynotes->w_prefs_force = GTK_WIDGET (>K_CHECK_BUTTON (
gtk_builder_get_object (stickynotes->builder,
"force_default_check"))->toggle_button);
stickynotes->w_prefs_desktop = GTK_WIDGET (>K_CHECK_BUTTON (
gtk_builder_get_object (stickynotes->builder,
"desktop_hide_check"))->toggle_button);
g_signal_connect (G_OBJECT (stickynotes->w_prefs), "response",
G_CALLBACK (preferences_response_cb), NULL);
g_signal_connect (G_OBJECT (stickynotes->w_prefs), "delete-event",
G_CALLBACK (preferences_delete_cb), NULL);
g_signal_connect_swapped (G_OBJECT (stickynotes->w_prefs_width),
"value-changed",
G_CALLBACK (preferences_save_cb), NULL);
g_signal_connect_swapped (G_OBJECT (stickynotes->w_prefs_height),
"value-changed",
G_CALLBACK (preferences_save_cb), NULL);
g_signal_connect_swapped (G_OBJECT (stickynotes->w_prefs_sys_color),
"toggled",
G_CALLBACK (preferences_save_cb), NULL);
g_signal_connect_swapped (G_OBJECT(stickynotes->w_prefs_sys_font),
"toggled", G_CALLBACK (preferences_save_cb), NULL);
g_signal_connect (G_OBJECT (stickynotes->w_prefs_color),
"color-set", G_CALLBACK (preferences_color_cb), NULL);
g_signal_connect (G_OBJECT (stickynotes->w_prefs_font_color),
"color-set", G_CALLBACK (preferences_color_cb), NULL);
g_signal_connect (G_OBJECT (stickynotes->w_prefs_font),
"font-set", G_CALLBACK (preferences_font_cb), NULL);
g_signal_connect_swapped (G_OBJECT (stickynotes->w_prefs_sticky),
"toggled", G_CALLBACK (preferences_save_cb), NULL);
g_signal_connect_swapped (G_OBJECT (stickynotes->w_prefs_force),
"toggled", G_CALLBACK (preferences_save_cb), NULL);
g_signal_connect_swapped (G_OBJECT (stickynotes->w_prefs_desktop),
"toggled", G_CALLBACK (preferences_save_cb), NULL);
{
GtkSizeGroup *group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget(group, GTK_WIDGET (gtk_builder_get_object (stickynotes->builder, "width_label")));
gtk_size_group_add_widget(group, GTK_WIDGET (gtk_builder_get_object (stickynotes->builder, "height_label")));
gtk_size_group_add_widget(group, GTK_WIDGET (gtk_builder_get_object (stickynotes->builder, "prefs_color_label")));
g_object_unref(group);
}
if (!gconf_client_key_is_writable(stickynotes->gconf,
GCONF_PATH "/defaults/width", NULL))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "width_label")),
FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "width_spin")),
FALSE);
}
if (!gconf_client_key_is_writable (stickynotes->gconf,
GCONF_PATH "/defaults/height", NULL))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "height_label")),
FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
stickynotes->builder, "height_spin")),
FALSE);
}
if (!gconf_client_key_is_writable (stickynotes->gconf,
GCONF_PATH "/defaults/color", NULL))
{
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
//.........这里部分代码省略.........
开发者ID:JonahAragon,项目名称:consort-applets,代码行数:101,代码来源:stickynotes_applet.c
示例6: gtr_torrent_options_dialog_new
GtkWidget*
gtr_torrent_options_dialog_new (GtkWindow * parent, TrCore * core, tr_ctor * ctor)
{
const char * str;
GtkWidget * w;
GtkWidget * d;
GtkGrid * grid;
int row;
GtkWidget * l;
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,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
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);
gtk_window_set_default_size(GTK_WINDOW(d),
gtr_pref_int_get (TR_KEY_details_window_width),
gtr_pref_int_get (TR_KEY_details_window_height));
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);
row = 0;
grid = GTK_GRID (gtk_grid_new ());
gtk_container_set_border_width (GTK_CONTAINER (grid), GUI_PAD_BIG);
gtk_grid_set_row_spacing (grid, GUI_PAD);
gtk_grid_set_column_spacing (grid, GUI_PAD_BIG);
/* "torrent file" row */
l = gtk_label_new_with_mnemonic (_("_Torrent file:"));
gtk_misc_set_alignment (GTK_MISC (l), 0.0f, 0.5f);
gtk_grid_attach (grid, l, 0, row, 1, 1);
w = gtk_file_chooser_button_new (_("Select Source File"),
GTK_FILE_CHOOSER_ACTION_OPEN);
source_chooser = w;
gtk_widget_set_hexpand (w, TRUE);
gtk_grid_attach_next_to (grid, w, l, GTK_POS_RIGHT, 1, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (l), w);
addTorrentFilters (GTK_FILE_CHOOSER (w));
g_signal_connect (w, "selection-changed",
G_CALLBACK (sourceChanged), data);
/* "destination folder" row */
row++;
l = gtk_label_new_with_mnemonic (_("_Destination folder:"));
gtk_misc_set_alignment (GTK_MISC (l), 0.0f, 0.5f);
gtk_grid_attach (grid, l, 0, row, 1, 1);
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_grid_attach_next_to (grid, w, l, GTK_POS_RIGHT, 1, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (l), w);
g_signal_connect (w, "selection-changed",
G_CALLBACK (downloadDirChanged), data);
row++;
l = data->freespace_label = gtr_freespace_label_new (core, data->downloadDir);
gtk_widget_set_margin_bottom (l, GUI_PAD_BIG);
gtk_misc_set_alignment (GTK_MISC (l), 1.0f, 0.5f);
gtk_grid_attach (grid, l, 0, row, 2, 1);
/* file list row */
row++;
//.........这里部分代码省略.........
开发者ID:armandas,项目名称:transmission,代码行数:101,代码来源:open-dialog.c
示例7: main
//.........这里部分代码省略.........
} else
g_message(_("Firmware updated successfully. Please reconnect device."));
goto exit2;
}
if (parameter_just_print_actual_profile) {
if (!print_actual_profile(konextdoptical, &local_error)) {
g_critical(_("Could not print actual profile: %s"), local_error->message);
retval = EXIT_FAILURE;
}
goto exit2;
}
if (parameter_just_reset) {
if (!reset(konextdoptical, &local_error)) {
g_critical(_("Could not reset device: %s"), local_error->message);
retval = EXIT_FAILURE;
}
goto exit2;
}
if (parameter_read_firmware) {
if (!print_firmware(konextdoptical, &local_error)) {
g_critical(_("Could not print firmware version: %s"), local_error->message);
retval = EXIT_FAILURE;
goto exit2;
}
}
if (parameter_sensor_read) {
if (!print_sensor_value(konextdoptical, &local_error)) {
g_critical(_("Could not read sensor register: %s"), local_error->message);
retval = EXIT_FAILURE;
goto exit2;
}
}
if (parameter_sensor_write != -1) {
koneplus_sensor_write_register(konextdoptical, parameter_sensor_register, parameter_sensor_write, &local_error);
if (local_error) {
g_critical(_("Could not write sensor register: %s"), local_error->message);
retval = EXIT_FAILURE;
goto exit2;
}
}
if (parameter_load != -1) {
rmp = konextdoptical_rmp_load(konextdoptical, parameter_load - 1, &local_error);
if (!rmp) {
g_critical(_("Could not load profile %i: %s"), parameter_load, local_error->message);
retval = EXIT_FAILURE;
goto exit2;
}
} else if (parameter_in_rmp) {
rmp = koneplus_rmp_read_with_path(parameter_in_rmp, konextdoptical_rmp_defaults(), &local_error);
if (!rmp) {
g_critical(_("Could not read rmp %s: %s"), parameter_in_rmp, local_error->message);
retval = EXIT_FAILURE;
goto exit2;
}
} else
rmp = konextdoptical_default_rmp();
koneplus_rmp_set_modified(rmp);
if (parameter_save != -1) {
if (!konextdoptical_rmp_save(konextdoptical, rmp, parameter_save - 1, &local_error)) {
g_critical(_("Could not save profile %i: %s"), parameter_save, local_error->message);
retval = EXIT_FAILURE;
goto exit3;
}
konextdoptical_dbus_emit_profile_data_changed_outside_instant(parameter_save);
}
if (parameter_out_rmp) {
if (!koneplus_rmp_write_with_path(parameter_out_rmp, rmp, &local_error)) {
g_critical(_("Could not write rmp %s: %s"), parameter_out_rmp, local_error->message);
retval = EXIT_FAILURE;
goto exit3;
}
}
if (parameter_activate_profile != -1) {
if (!koneplus_actual_profile_write(konextdoptical, parameter_activate_profile -1, &local_error)) {
g_critical(_("Could not activate profile %i: %s"), parameter_activate_profile, local_error->message);
retval = EXIT_FAILURE;
goto exit3;
}
konextdoptical_dbus_emit_profile_changed_outside_instant(parameter_activate_profile);
}
exit3:
koneplus_rmp_free(rmp);
exit2:
g_object_unref(G_OBJECT(konextdoptical));
exit1:
commandline_free(context);
g_clear_error(&local_error);
exit(retval);
}
开发者ID:ngg,项目名称:roccat-tools,代码行数:101,代码来源:konextdopticalcontrol.c
示例8: main
int main(int argc, char *argv[])
{
if (argc < 3) {
printf("Usage: %s <username> <password>\n", argv[0]);
return 1;
}
GtkWidget *vbox;
GtkWidget *swin;
GtkTreeSelection *selection;
/* Create needed variables - not anymore, use appdata instead
HildonProgram *program;
HildonWindow *window; */
/* Create AppData */
AppData *appdata=g_malloc( sizeof( *appdata ) );
/* Initialize the GTK. */
gtk_init(&argc, &argv);
/* Create the Hildon program and setup the title */
g_set_application_name("Maemify");
#ifdef MAEMO4
appdata->program = HILDON_PROGRAM(hildon_program_get_instance());
/* Create HildonWindow and set it to HildonProgram */
appdata->window = HILDON_WINDOW(hildon_window_new());
hildon_program_add_window(appdata->program, appdata->window);
#else
appdata->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (appdata->window), "Maemify");
gtk_widget_set_usize( GTK_WIDGET ( appdata->window ) , 600 , 300 );
/* create our table */
appdata->table = gtk_table_new(3, 3, FALSE); //three rows, three columns, not homogenous
gtk_container_add(GTK_CONTAINER(appdata->window),appdata->table);
#endif
/* Create find toolbar, but keep it hidden */
create_find_toolbar(appdata);
#ifdef MAEMO4
gtk_widget_show_all(GTK_WIDGET(appdata->find_toolbar));
/* Create menu for the Window */
create_menu(appdata->window);
#else
gtk_table_attach_defaults(GTK_TABLE(appdata->table), GTK_WIDGET(appdata->entry), 1, 2, 2, 3);
gtk_widget_show_all(GTK_WIDGET(appdata->table));
#endif
/* Begin the main application */
gtk_widget_show_all(GTK_WIDGET(appdata->window));
/* Connect signal to X in the upper corner */
g_signal_connect(G_OBJECT(appdata->window), "delete_event",
G_CALLBACK(gtk_main_quit), NULL);
if (!despotify_init())
{
printf("despotify_init() failed\n");
return 1;
}
appdata->ds = despotify_init_client(callback, NULL, false);
if (!appdata->ds) {
printf("despotify_init_client() failed\n");
return 1;
}
if (!despotify_authenticate(appdata->ds, argv[1], argv[2])) {
printf( "Authentication failed: %s\n", despotify_get_error(appdata->ds));
despotify_exit(appdata->ds);
return 1;
}
/* Create a tree view and place it in a scrolled window */
appdata->list = gtk_tree_view_new();
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(appdata->list), TRUE);
swin = gtk_scrolled_window_new(NULL, NULL);
vbox = gtk_vbox_new(FALSE, 0);
/* add labels to the fields */
appdata->label = gtk_label_new("Search hits");
gtk_label_set_justify(GTK_LABEL(appdata->label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start(GTK_BOX(vbox), appdata->label, FALSE, FALSE, 5);
gtk_container_add(GTK_CONTAINER(swin), appdata->list);
#ifdef MAEMO4
gtk_container_add(GTK_CONTAINER(appdata->window), swin);
#else
gtk_table_attach_defaults(GTK_TABLE(appdata->table), swin, 1, 2, 1, 2);
#endif
/* initialize a list to hold search hits */
init_list(appdata->list);
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(appdata->list));
g_signal_connect(selection, "changed",
//.........这里部分代码省略.........
开发者ID:FauxFaux,项目名称:despotify,代码行数:101,代码来源:maemify.c
示例9: set_state
static void
set_state (GtkTextBuffer *buffer,
guint32 state)
{
g_object_set_data (G_OBJECT (buffer), E_BUFFER_TAGGER_DATA_STATE, GINT_TO_POINTER (state));
}
开发者ID:UIKit0,项目名称:evolution,代码行数:6,代码来源:e-buffer-tagger.c
示例10: gimp_curve_calculate
static void
gimp_curve_calculate (GimpCurve *curve)
{
gint *points;
gint i;
gint num_pts;
gint p1, p2, p3, p4;
if (gimp_data_is_frozen (GIMP_DATA (curve)))
return;
points = g_newa (gint, curve->n_points);
switch (curve->curve_type)
{
case GIMP_CURVE_SMOOTH:
/* cycle through the curves */
num_pts = 0;
for (i = 0; i < curve->n_points; i++)
if (curve->points[i].x >= 0.0)
points[num_pts++] = i;
/* Initialize boundary curve points */
if (num_pts != 0)
{
GimpVector2 point;
gint boundary;
point = curve->points[points[0]];
boundary = ROUND (point.x * (gdouble) (curve->n_samples - 1));
for (i = 0; i < boundary; i++)
curve->samples[i] = point.y;
point = curve->points[points[num_pts - 1]];
boundary = ROUND (point.x * (gdouble) (curve->n_samples - 1));
for (i = boundary; i < curve->n_samples; i++)
curve->samples[i] = point.y;
}
for (i = 0; i < num_pts - 1; i++)
{
p1 = points[MAX (i - 1, 0)];
p2 = points[i];
p3 = points[i + 1];
p4 = points[MIN (i + 2, num_pts - 1)];
gimp_curve_plot (curve, p1, p2, p3, p4);
}
/* ensure that the control points are used exactly */
for (i = 0; i < num_pts; i++)
{
gdouble x = curve->points[points[i]].x;
gdouble y = curve->points[points[i]].y;
curve->samples[ROUND (x * (gdouble) (curve->n_samples - 1))] = y;
}
g_object_notify (G_OBJECT (curve), "samples");
break;
case GIMP_CURVE_FREE:
break;
}
}
开发者ID:ellelstone,项目名称:gimp,代码行数:67,代码来源:gimpcurve.c
示例11: gtkgui_init
bool gtkgui_init(int argc, char *argv[], Stream_mixer *mix)
{
GtkWidget *bbox = NULL;
bool isx = false;
/* FIXME: bisogan mettere l'enable_nls*/
/* i18n */
setlocale(LC_ALL, "");
bindtextdomain("muse", LOCALEDIR);
bind_textdomain_codeset("muse", "UTF-8");
textdomain("muse");
/* initialization */
state = true;
mixer = mix;
list_init(&listachan);
list_init(&lamelist);
list_init(&ogglist);
iceprof = lameprof = vorbisprof = NULL;
if(!profile_init())
error(_("profile initialization error"));
profile_ice_load();
/* profile_lame_load and profile_vorbis_load are into encoder.cpp */
pathfile = NULL;
/* signal to glib we're going to use threads */
g_thread_init(NULL);
isx = gtk_init_check(&argc,&argv);
if(!isx)
return false;
isx = mixer->set_lineout(true);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), _("MuSE-cvs Gtk+2"));
gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
gtk_container_set_border_width(GTK_CONTAINER(window), 12);
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(gcb_exit), NULL);
/* FIXME: gtk2 remove ? */
gtk_widget_realize(window);
vbox=gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), vbox);
fix = gtk_fixed_new();
gtk_box_pack_start(GTK_BOX(vbox), fix, FALSE, FALSE, 0);
bbox = createbbox(bbox);
gtk_fixed_put(GTK_FIXED(fix), bbox, 0, 0);
if(isx)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(speakout), TRUE);
pack_new();
createch();
putstatusbar();
/*let's show window */
gtk_widget_show_all(window);
gtk_widget_hide(pack1.hscale);
gtk_widget_hide(pack2.hscale);
gtk_widget_hide(pack3.hscale);
return true;
}
开发者ID:rektide,项目名称:dyne-muse,代码行数:73,代码来源:musegtk.cpp
示例12: gegl_node_set_props
static void
gegl_node_set_props (GeglNode *node,
va_list var_args)
{
const char *property_name;
g_object_freeze_notify (G_OBJECT (node));
property_name = va_arg (var_args, gchar *);
while (property_name)
{
GValue value = { 0, };
GParamSpec *pspec = NULL;
gchar *error = NULL;
if (!strcmp (property_name, "name"))
{
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (G_OBJECT (node)), property_name);
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
G_VALUE_COLLECT (&value, var_args, 0, &error);
if (error)
{
g_warning ("%s: %s", G_STRFUNC, error);
g_free (error);
g_value_unset (&value);
break;
}
g_object_set_property (G_OBJECT (node), property_name, &value);
g_value_unset (&value);
}
else
{
if (node->operation)
{
pspec = g_object_class_find_property (
G_OBJECT_GET_CLASS (G_OBJECT (node->operation)), property_name);
}
if (!pspec)
{
g_warning ("%s:%s has no property named: '%s'",
G_STRFUNC,
gegl_node_get_debug_name (node), property_name);
break;
}
if (!(pspec->flags & G_PARAM_WRITABLE))
{
g_warning ("%s: property (%s of operation class '%s' is not writable",
G_STRFUNC,
pspec->name,
G_OBJECT_TYPE_NAME (node->operation));
break;
}
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
G_VALUE_COLLECT (&value, var_args, 0, &error);
if (error)
{
g_warning ("%s: %s", G_STRFUNC, error);
g_free (error);
g_value_unset (&value);
break;
}
g_object_set_property (G_OBJECT (node->operation), property_name, &value);
g_value_unset (&value);
}
property_name = va_arg (var_args, gchar *);
}
g_object_thaw_notify (G_OBJECT (node));
}
开发者ID:kleopatra999,项目名称:gegl-global-matting,代码行数:71,代码来源:gegl-apply.c
示例13: nautilus_file_management_properties_dialog_setup
static void
nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *window)
{
GtkWidget *dialog;
/* setup UI */
nautilus_file_management_properties_size_group_create (builder,
"views_label",
4);
nautilus_file_management_properties_size_group_create (builder,
"captions_label",
3);
nautilus_file_management_properties_size_group_create (builder,
"preview_label",
3);
/* setup preferences */
bind_builder_bool (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET,
NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST);
bind_builder_bool (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET,
NAUTILUS_PREFERENCES_CONFIRM_TRASH);
bind_builder_bool (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET,
NAUTILUS_PREFERENCES_ENABLE_DELETE);
bind_builder_bool (builder, gtk_filechooser_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET,
NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
bind_builder_bool (builder, nautilus_list_view_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_USE_TREE_WIDGET,
NAUTILUS_PREFERENCES_LIST_VIEW_USE_TREE);
bind_builder_enum (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DEFAULT_VIEW_WIDGET,
NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER,
(const char **) default_view_values);
bind_builder_enum (builder, nautilus_icon_view_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ICON_VIEW_ZOOM_WIDGET,
NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
(const char **) zoom_values);
bind_builder_enum (builder, nautilus_list_view_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET,
NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
(const char **) zoom_values);
bind_builder_enum (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET,
NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER,
(const char **) sort_order_values);
bind_builder_enum (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FILES_WIDGET,
NAUTILUS_PREFERENCES_SHOW_FILE_THUMBNAILS,
(const char **) preview_values);
bind_builder_enum (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET,
NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
(const char **) preview_values);
bind_builder_radio (builder, nautilus_preferences,
(const char **) click_behavior_components,
NAUTILUS_PREFERENCES_CLICK_POLICY,
(const char **) click_behavior_values);
bind_builder_radio (builder, nautilus_preferences,
(const char **) executable_text_components,
NAUTILUS_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION,
(const char **) executable_text_values);
bind_builder_uint_enum (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET,
NAUTILUS_PREFERENCES_FILE_THUMBNAIL_LIMIT,
thumbnail_limit_values,
G_N_ELEMENTS (thumbnail_limit_values));
nautilus_file_management_properties_dialog_setup_icon_caption_page (builder);
nautilus_file_management_properties_dialog_setup_list_column_page (builder);
/* UI callbacks */
dialog = GTK_WIDGET (gtk_builder_get_object (builder, "file_management_dialog"));
g_signal_connect_data (dialog, "response",
G_CALLBACK (nautilus_file_management_properties_dialog_response_cb),
g_object_ref (builder),
(GClosureNotify)g_object_unref,
0);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_set_icon_name (GTK_WINDOW (dialog), "system-file-manager");
if (window) {
gtk_window_set_screen (GTK_WINDOW (dialog), gtk_window_get_screen(window));
}
preferences_dialog = dialog;
g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &preferences_dialog);
gtk_widget_show (dialog);
}
开发者ID:GeorgesStavracas,项目名称:eos-file-manager,代码行数:97,代码来源:nautilus-file-management-properties.c
示例14: gegl_graph_process
/**
* gegl_graph_process:
* @path: The traversal path
*
* Process the prepared request. This will return the
* resulting buffer from the final node, or NULL if
* that node is a sink.
*
* If gegl_graph_prepare_request has not been called
* the behavior of this function is undefined.
*
* Return value: (transfer full): The result of the graph, or NULL if
* there is no output pad.
*/
GeglBuffer *
gegl_graph_process (GeglGraphTraversal *path,
gint level)
{
GList *list_iter = NULL;
GeglBuffer *result = NULL;
GeglOperationContext *context = NULL;
GeglOperationContext *last_context = NULL;
GeglBuffer *operation_result = NULL;
for (list_iter = path->dfs_path; list_iter; list_iter = list_iter->next)
{
GeglNode *node = GEGL_NODE (list_iter->data);
GeglOperation *operation = node->operation;
g_return_val_if_fail (node, NULL);
g_return_val_if_fail (operation, NULL);
GEGL_INSTRUMENT_START();
operation_result = NULL;
if (last_context)
gegl_operation_context_purge (last_context);
context = g_hash_table_lookup (path->contexts, node);
g_return_val_if_fail (context, NULL);
GEGL_NOTE (GEGL_DEBUG_PROCESS,
"Will process %s result_rect = %d, %d %d×%d",
gegl_node_get_debug_name (node),
context->result_rect.x, context->result_rect.y, context->result_rect.width, context->result_rect.height);
if (context->need_rect.width > 0 && context->need_rect.height > 0)
{
if (context->cached)
{
GEGL_NOTE (GEGL_DEBUG_PROCESS,
"Using cached result for %s",
gegl_node_get_debug_name (node));
operation_result = GEGL_BUFFER (node->cache);
}
else
{
/* Guarantee input pad */
if (gegl_node_has_pad (node, "input") &&
!gegl_operation_context_get_object (context, "input"))
{
gegl_operation_context_set_object (context, "input", G_OBJECT (gegl_graph_get_shared_empty(path)));
}
context->level = level;
gegl_operation_process (operation, context, "output", &context->need_rect, context->level);
operation_result = GEGL_BUFFER (gegl_operation_context_get_object (context, "output"));
if (operation_result && operation_result == (GeglBuffer *)operation->node->cache)
gegl_cache_computed (operation->node->cache, &context->need_rect, level);
}
}
else
{
operation_result = NULL;
}
if (operation_result)
{
GeglPad *output_pad = gegl_node_get_pad (node, "output");
GList *targets = gegl_graph_get_connected_output_contexts (path, output_pad);
GList *targets_iter;
GEGL_NOTE (GEGL_DEBUG_PROCESS,
"Will deliver the results of %s:%s to %d targets",
gegl_node_get_debug_name (node),
"output",
g_list_length (targets));
if (g_list_length (targets) > 1)
gegl_object_set_has_forked (G_OBJECT (operation_result));
|
请发表评论