void cmd_autoshrink_img() { g_object_set (G_OBJECT(view_settings()), "auto-shrink-images", uzbl.behave.autoshrink_img, NULL); }
void cmd_minimum_font_size() { g_object_set (G_OBJECT(view_settings()), "minimum-font-size", uzbl.behave.minimum_font_size, NULL); }
void cmd_autoload_img() { g_object_set (G_OBJECT(view_settings()), "auto-load-images", uzbl.behave.autoload_img, NULL); }
void cmd_disable_plugins() { g_object_set (G_OBJECT(view_settings()), "enable-plugins", !uzbl.behave.disable_plugins, NULL); }
void cmd_disable_scripts() { g_object_set (G_OBJECT(view_settings()), "enable-scripts", !uzbl.behave.disable_scripts, NULL); }
void cmd_fantasy_font_family() { g_object_set (G_OBJECT(view_settings()), "fantasy-font-family", uzbl.behave.fantasy_font_family, NULL); }
void cmd_enable_pagecache() { g_object_set (G_OBJECT(view_settings()), "enable-page-cache", uzbl.behave.enable_pagecache, NULL); }
void cmd_serif_font_family() { g_object_set (G_OBJECT(view_settings()), "serif-font-family", uzbl.behave.serif_font_family, NULL); }
void cmd_cursive_font_family() { g_object_set (G_OBJECT(view_settings()), "cursive-font-family", uzbl.behave.cursive_font_family, NULL); }
void cmd_monospace_font_family() { g_object_set (G_OBJECT(view_settings()), "monospace-font-family", uzbl.behave.monospace_font_family, NULL); }
void cmd_default_font_family() { g_object_set (G_OBJECT(view_settings()), "default-font-family", uzbl.behave.default_font_family, NULL); }
void cmd_max_conns_host() { g_object_set(G_OBJECT(uzbl.net.soup_session), SOUP_SESSION_MAX_CONNS_PER_HOST, uzbl.net.max_conns_host, NULL); }
void cmd_enable_spellcheck() { g_object_set (G_OBJECT(view_settings()), "enable-spell-checking", uzbl.behave.enable_spellcheck, NULL); }
void cmd_enable_private() { g_object_set (G_OBJECT(view_settings()), "enable-private-browsing", uzbl.behave.enable_private, NULL); }
void nemo_action_constructed (GObject *object) { G_OBJECT_CLASS (parent_class)->constructed (object); NemoAction *action = NEMO_ACTION (object); GKeyFile *key_file = g_key_file_new(); g_key_file_load_from_file (key_file, action->key_file_path, G_KEY_FILE_NONE, NULL); gchar *orig_label = g_key_file_get_locale_string (key_file, ACTION_FILE_GROUP, KEY_NAME, NULL, NULL); gchar *orig_tt = g_key_file_get_locale_string (key_file, ACTION_FILE_GROUP, KEY_COMMENT, NULL, NULL); gchar *icon_name = g_key_file_get_string (key_file, ACTION_FILE_GROUP, KEY_ICON_NAME, NULL); gchar *stock_id = g_key_file_get_string (key_file, ACTION_FILE_GROUP, KEY_STOCK_ID, NULL); gchar *exec_raw = g_key_file_get_string (key_file, ACTION_FILE_GROUP, KEY_EXEC, NULL); gchar *selection_string = g_key_file_get_string (key_file, ACTION_FILE_GROUP, KEY_SELECTION, NULL); SelectionType type; if (g_strcmp0 (selection_string, SELECTION_SINGLE_KEY) == 0) type = SELECTION_SINGLE; else if (g_strcmp0 (selection_string, SELECTION_MULTIPLE_KEY) == 0) type = SELECTION_MULTIPLE; else if (g_strcmp0 (selection_string, SELECTION_ANY_KEY) == 0) type = SELECTION_ANY; else if (g_strcmp0 (selection_string, SELECTION_NONE_KEY) == 0) type = SELECTION_NONE; else if (g_strcmp0 (selection_string, SELECTION_NOT_NONE_KEY) == 0) type = SELECTION_NOT_NONE; else { gint val = (int) g_ascii_strtoll (selection_string, NULL, 10); type = val > 0 ? val : SELECTION_SINGLE; } g_free (selection_string); gsize count; gchar **ext = g_key_file_get_string_list (key_file, ACTION_FILE_GROUP, KEY_EXTENSIONS, &count, NULL); gsize mime_count; gchar **mimes = g_key_file_get_string_list (key_file, ACTION_FILE_GROUP, KEY_MIME_TYPES, &mime_count, NULL); gchar *exec = NULL; gboolean use_parent_dir = FALSE; strip_custom_modifier (exec_raw, &use_parent_dir, &exec); g_free (exec_raw); GFile *file = g_file_new_for_path (action->key_file_path); GFile *parent = g_file_get_parent (file); gchar *parent_dir = g_file_get_path (parent); g_object_unref (file); g_object_unref (parent); g_object_set (action, "label", orig_label, "tooltip", orig_tt, "icon-name", icon_name, "stock-id", stock_id, "exec", exec, "selection-type", type, "ext-length", count, "extensions", ext, "mime-length", mime_count, "mimetypes", mimes, "parent-dir", parent_dir, "use-parent-dir", use_parent_dir, "orig-label", orig_label, "orig-tooltip", orig_tt, NULL); g_free (orig_label); g_free (orig_tt); g_free (icon_name); g_free (stock_id); g_free (exec); g_strfreev (ext); g_free (parent_dir); g_key_file_free (key_file); }
static void on_dialog_add_edit_reponse (GtkWidget *dialog, int response_id, LogviewFilterManager *manager) { GtkWidget *entry_name, *entry_regex; GtkWidget *radio_color, *radio_visible; GtkWidget *check_foreground, *check_background; GtkWidget *color_foreground, *color_background; gchar *old_name; const gchar *name; const gchar *regex; LogviewFilter *filter; GtkTextTag *tag; GtkBuilder *builder; old_name = g_object_get_data (G_OBJECT (manager), "old_name"); builder = manager->priv->builder; entry_name = GTK_WIDGET (gtk_builder_get_object (builder, "entry_name")); entry_regex = GTK_WIDGET (gtk_builder_get_object (builder, "entry_regex")); radio_color = GTK_WIDGET (gtk_builder_get_object (builder, "radio_color")); radio_visible = GTK_WIDGET (gtk_builder_get_object (builder, "radio_visible")); check_foreground = GTK_WIDGET (gtk_builder_get_object (builder, "check_foreground")); check_background = GTK_WIDGET (gtk_builder_get_object (builder, "check_background")); color_foreground = GTK_WIDGET (gtk_builder_get_object (builder, "color_foreground")); color_background = GTK_WIDGET (gtk_builder_get_object (builder, "color_background")); if (response_id == GTK_RESPONSE_APPLY) { name = gtk_entry_get_text (GTK_ENTRY (entry_name)); regex = gtk_entry_get_text (GTK_ENTRY (entry_regex)); if (!check_name (manager, name) || !check_regex (manager, regex)) { return; } filter = logview_filter_new (name, regex); tag = gtk_text_tag_new (name); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_color))) { if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground))) { GdkColor foreground_color; gtk_color_button_get_color (GTK_COLOR_BUTTON (color_foreground), &foreground_color); g_object_set (G_OBJECT (tag), "foreground-gdk", &foreground_color, "foreground-set", TRUE, NULL); } if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) { GdkColor background_color; gtk_color_button_get_color (GTK_COLOR_BUTTON (color_background), &background_color); g_object_set (tag, "paragraph-background-gdk", &background_color, "paragraph-background-set", TRUE, NULL); } if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_foreground)) && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_background))) { GtkWidget *error_dialog; error_dialog = gtk_message_dialog_new (GTK_WINDOW (manager), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", _("Please specify either foreground or background color!")); gtk_dialog_run (GTK_DIALOG (error_dialog)); gtk_widget_destroy (error_dialog); g_object_unref (tag); g_object_unref (filter); return; } } else { /* !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_color)) */ g_object_set (tag, "invisible", TRUE, NULL); } if (old_name && !g_str_equal (old_name, name)) { logview_prefs_remove_filter (manager->priv->prefs, old_name); } g_object_set (G_OBJECT (filter), "texttag", tag, NULL); g_object_unref (tag); logview_prefs_add_filter (manager->priv->prefs, filter); g_object_unref (filter); logview_filter_manager_update_model (manager); } gtk_widget_destroy (dialog); }
static void parse_property(Log4gConfigurator *base, xmlNodePtr node, gpointer object) { GParamSpec *spec = NULL; xmlChar *name = xmlGetProp(node, (const xmlChar *)"name"); xmlChar *value = xmlGetProp(node, (const xmlChar *)"value"); if (!name) { log4g_log_error(Q_("properties must have a `name' attribute")); goto exit; } if (!value) { log4g_log_error(Q_("properties must have a " "`value' attribute")); goto exit; } spec = g_object_class_find_property(G_OBJECT_GET_CLASS(object), (gchar *)name); if (!spec) { log4g_log_error(Q_("object does not have the property `%s'"), (gchar *)name); goto exit; } if (G_TYPE_STRING == spec->value_type) { g_object_set(object, (const gchar *)name, (const gchar *)value, NULL); } else if (G_TYPE_BOOLEAN == spec->value_type) { if (!g_ascii_strcasecmp((const gchar *)value, "true")) { g_object_set(object, (const gchar *)name, TRUE, NULL); } else if (!g_ascii_strcasecmp((const gchar *)value, "false")) { g_object_set(object, (const gchar *)name, FALSE, NULL); } else { log4g_log_error(Q_("%s: not a boolean value " "(true|false)"), value); goto exit; } } else if (G_TYPE_CHAR == spec->value_type) { if (1 != strlen((const char *)value)) { log4g_log_error(Q_("%s: not a char"), value); goto exit; } g_object_set(object, (const gchar *)name, *value, NULL); } else if (G_TYPE_UCHAR == spec->value_type) { if (1 != strlen((const char *)value)) { log4g_log_error(Q_("%s: not an uchar"), value); goto exit; } g_object_set(object, (const gchar *)name, *value, NULL); } else if (G_TYPE_INT == spec->value_type) { gint64 i; errno = 0; i = g_ascii_strtoll((const char *)value, NULL, 10); if (errno) { log4g_log_error(Q_("%s: not an int"), value); goto exit; } g_object_set(object, (const char *)name, (gint)i, NULL); } else if (G_TYPE_UINT == spec->value_type) { guint64 i; errno = 0; i = g_ascii_strtoull((const char *)value, NULL, 10); if (errno) { log4g_log_error(Q_("%s: not an uint"), value); goto exit; } g_object_set(object, (const char *)name, (guint)i, NULL); } else if (G_TYPE_LONG == spec->value_type) { gint64 i; errno = 0; i = g_ascii_strtoll((const char *)value, NULL, 10); if (errno) { log4g_log_error(Q_("%s: not a long"), value); goto exit; } g_object_set(object, (const char *)name, (glong)i, NULL); } else if (G_TYPE_ULONG == spec->value_type) { guint64 i; errno = 0; i = g_ascii_strtoull((const char *)value, NULL, 10); if (errno) { log4g_log_error(Q_("%s: not an ulong"), value); goto exit; } g_object_set(object, (const char *)name, (gulong)i, NULL); } else if (G_TYPE_INT64 == spec->value_type) { gint64 i; errno = 0; i = g_ascii_strtoll((const char *)value, NULL, 10); if (errno) { log4g_log_error(Q_("%s: not an int64"), value); goto exit; } g_object_set(object, (const char *)name, i, NULL); } else if (G_TYPE_UINT64 == spec->value_type) { guint64 i; errno = 0; i = g_ascii_strtoull((const char *)value, NULL, 10); if (errno) { log4g_log_error(Q_("%s: not an uint64"), value); goto exit; } g_object_set(object, (const char *)name, i, NULL); } else if (G_TYPE_FLOAT == spec->value_type) { gdouble d; errno = 0; d = g_ascii_strtod((gchar *)value, NULL); if (errno) { log4g_log_error(Q_("%s: not a float"), value); goto exit; } g_object_set(object, (const gchar *)name, (gfloat)d, NULL); } else if (G_TYPE_DOUBLE == spec->value_type) { gdouble d; errno = 0; d = g_ascii_strtod((gchar *)value, NULL); if (errno) { log4g_log_error(Q_("%s: not a double"), value); goto exit; } g_object_set(object, (const gchar *)name, d, NULL); } else if (G_TYPE_OBJECT == spec->value_type) { struct Private *priv = GET_PRIVATE(base); GObject *o = g_hash_table_lookup(priv->objects, (const gchar *)value); if (!o) { log4g_log_error(Q_("%s: undefined object"), value); goto exit; } g_object_set(object, (const gchar *)name, o, NULL); } else { log4g_log_warn(Q_("%s: property cannot be set via DOM " "configuration"), name); goto exit; } exit: if (spec) { g_param_spec_unref(spec); } if (name) { xmlFree(name); } if (value) { xmlFree(value); } }
static void nautilus_toolbar_constructed (GObject *obj) { NautilusToolbar *self = NAUTILUS_TOOLBAR (obj); GtkWidget *toolbar; GtkWidget *button; GtkWidget *menu; GtkWidget *box; GtkWidget *separator; GtkUIManager *ui_manager; gboolean rtl; G_OBJECT_CLASS (nautilus_toolbar_parent_class)->constructed (obj); gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "header-bar"); self->priv->toolbar = toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); g_object_set (toolbar, "margin", 8, NULL); gtk_container_add (GTK_CONTAINER (self), toolbar); rtl = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL; ui_manager = nautilus_window_get_ui_manager (self->priv->window); gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (self)), GTK_JUNCTION_BOTTOM); /* Back and Forward */ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); /* Back */ button = toolbar_create_toolbutton (self, FALSE, FALSE, NAUTILUS_ACTION_BACK, NULL); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_action_set_icon_name (gtk_activatable_get_related_action (GTK_ACTIVATABLE (button)), rtl ? "go-previous-rtl-symbolic" : "go-previous-symbolic"); navigation_button_setup_menu (self, button, NAUTILUS_NAVIGATION_DIRECTION_BACK); gtk_container_add (GTK_CONTAINER (box), button); /* Forward */ button = toolbar_create_toolbutton (self, FALSE, FALSE, NAUTILUS_ACTION_FORWARD, NULL); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_action_set_icon_name (gtk_activatable_get_related_action (GTK_ACTIVATABLE (button)), rtl ? "go-next-rtl-symbolic" : "go-next-symbolic"); navigation_button_setup_menu (self, button, NAUTILUS_NAVIGATION_DIRECTION_FORWARD); gtk_container_add (GTK_CONTAINER (box), button); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED); gtk_box_pack_start (GTK_BOX (toolbar), box, FALSE, FALSE, 0); if (rtl) { gtk_widget_set_margin_left (box, 12); } else { gtk_widget_set_margin_right (box, 12); } /* regular path bar */ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); self->priv->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL); gtk_box_pack_start (GTK_BOX (box), self->priv->path_bar, TRUE, TRUE, 0); /* entry-like location bar */ self->priv->location_entry = nautilus_location_entry_new (); gtk_box_pack_start (GTK_BOX (box), self->priv->location_entry, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (toolbar), box, TRUE, TRUE, 0); /* search */ button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_SEARCH, NULL); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (toolbar), button); if (rtl) { gtk_widget_set_margin_right (button, 76); } else { gtk_widget_set_margin_left (button, 76); } /* View buttons */ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_LIST, NULL); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (box), button); button = toolbar_create_toolbutton (self, FALSE, TRUE, NAUTILUS_ACTION_VIEW_GRID, NULL); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (box), button); button = toolbar_create_toolbutton (self, TRUE, FALSE, "go-down-symbolic", _("View options")); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); gtk_container_add (GTK_CONTAINER (box), button); menu = gtk_ui_manager_get_widget (ui_manager, "/ViewMenu"); gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_RAISED); gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_LINKED); gtk_container_add (GTK_CONTAINER (toolbar), box); if (rtl) { gtk_widget_set_margin_right (box, 12); } else { gtk_widget_set_margin_left (box, 12); } /* Action Menu */ button = toolbar_create_toolbutton (self, TRUE, FALSE, "emblem-system-symbolic", _("Location options")); gtk_widget_set_valign (button, GTK_ALIGN_CENTER); menu = gtk_ui_manager_get_widget (ui_manager, "/ActionMenu"); gtk_widget_set_halign (menu, GTK_ALIGN_END); gtk_menu_button_set_popup (GTK_MENU_BUTTON (button), menu); gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "win.gear-menu"); g_signal_connect (menu, "key-press-event", G_CALLBACK (gear_menu_key_press), self); gtk_container_add (GTK_CONTAINER (toolbar), button); if (rtl) { gtk_widget_set_margin_right (button, 12); } else { gtk_widget_set_margin_left (button, 12); } /* Separator and Close */ separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL); gtk_container_add (GTK_CONTAINER (toolbar), separator); if (rtl) { gtk_widget_set_margin_right (separator, 8); } else { gtk_widget_set_margin_left (separator, 8); } button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); g_signal_connect (button, "clicked", G_CALLBACK (close_button_clicked), self); gtk_container_add (GTK_CONTAINER (toolbar), button); if (rtl) { gtk_widget_set_margin_right (button, 6); } else { gtk_widget_set_margin_left (button, 6); } g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, G_CALLBACK (toolbar_update_appearance), self); gtk_widget_show_all (toolbar); toolbar_update_appearance (self); }
int dt_gui_hist_dialog_new(dt_gui_hist_dialog_t *d, int imgid, gboolean iscopy) { int res; GtkWidget *window = dt_ui_main_window(darktable.gui->ui); GtkDialog *dialog = GTK_DIALOG(gtk_dialog_new_with_buttons( _("select parts"), GTK_WINDOW(window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, _("_cancel"), GTK_RESPONSE_CANCEL, _("select _all"), GTK_RESPONSE_YES, _("select _none"), GTK_RESPONSE_NONE, _("_ok"), GTK_RESPONSE_OK, NULL)); #ifdef GDK_WINDOWING_QUARTZ dt_osx_disallow_fullscreen(GTK_WIDGET(dialog)); #endif GtkContainer *content_area = GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); GtkBox *box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 3)); gtk_widget_set_margin_start(GTK_WIDGET(box), DT_PIXEL_APPLY_DPI(5)); gtk_widget_set_margin_end(GTK_WIDGET(box), DT_PIXEL_APPLY_DPI(5)); gtk_widget_set_margin_top(GTK_WIDGET(box), DT_PIXEL_APPLY_DPI(5)); gtk_widget_set_margin_bottom(GTK_WIDGET(box), DT_PIXEL_APPLY_DPI(5)); gtk_container_add(content_area, GTK_WIDGET(box)); /* create the list of items */ d->items = GTK_TREE_VIEW(gtk_tree_view_new()); GtkListStore *liststore = gtk_list_store_new(DT_HIST_ITEMS_NUM_COLS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT); /* enabled */ GtkCellRenderer *renderer = gtk_cell_renderer_toggle_new(); gtk_cell_renderer_toggle_set_activatable(GTK_CELL_RENDERER_TOGGLE(renderer), TRUE); g_object_set_data(G_OBJECT(renderer), "column", (gint *)DT_HIST_ITEMS_COL_ENABLED); g_signal_connect(renderer, "toggled", G_CALLBACK(_gui_hist_item_toggled), d); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(d->items), -1, _("include"), renderer, "active", DT_HIST_ITEMS_COL_ENABLED, NULL); /* name */ renderer = gtk_cell_renderer_text_new(); g_object_set_data(G_OBJECT(renderer), "column", (gint *)DT_HIST_ITEMS_COL_NAME); g_object_set(renderer, "xalign", 0.0, (gchar *)0); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(d->items), -1, _("item"), renderer, "text", DT_HIST_ITEMS_COL_NAME, NULL); gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(d->items)), GTK_SELECTION_SINGLE); gtk_tree_view_set_model(GTK_TREE_VIEW(d->items), GTK_TREE_MODEL(liststore)); gtk_box_pack_start(box, GTK_WIDGET(d->items), TRUE, TRUE, 0); /* fill list with history items */ GtkTreeIter iter; GList *items = dt_history_get_items(imgid, FALSE); if(items) { do { dt_history_item_t *item = (dt_history_item_t *)items->data; gtk_list_store_append(GTK_LIST_STORE(liststore), &iter); gtk_list_store_set(GTK_LIST_STORE(liststore), &iter, DT_HIST_ITEMS_COL_ENABLED, iscopy ? TRUE : _gui_is_set(d->selops, item->num), DT_HIST_ITEMS_COL_NAME, item->name, DT_HIST_ITEMS_COL_NUM, (guint)item->num, -1); } while((items = g_list_next(items))); g_list_free_full(items, dt_history_item_free); } else { dt_control_log(_("can't copy history out of unaltered image")); return GTK_RESPONSE_CANCEL; } g_object_unref(liststore); g_signal_connect(dialog, "response", G_CALLBACK(_gui_hist_copy_response), d); gtk_widget_show_all(GTK_WIDGET(dialog)); while(1) { res = gtk_dialog_run(GTK_DIALOG(dialog)); if(res == GTK_RESPONSE_CANCEL || res == GTK_RESPONSE_DELETE_EVENT || res == GTK_RESPONSE_OK) break; } gtk_widget_destroy(GTK_WIDGET(dialog)); return res; }
int main (int argc, char *argv[]) { GMainLoop *loop; GstRTSPServer *server; GstRTSPMountPoints *mounts; GstRTSPMediaFactory *factory; GOptionContext *optctx; GError *error = NULL; GstRTSPAuth *auth; GstRTSPToken *token; gchar *basic; #ifdef WITH_TLS GTlsCertificate *cert; #endif optctx = g_option_context_new ("<launch line> - Test RTSP Server, Launch\n\n" "Example: \"( decodebin name=depay0 ! autovideosink )\""); g_option_context_add_main_entries (optctx, entries, NULL); g_option_context_add_group (optctx, gst_init_get_option_group ()); if (!g_option_context_parse (optctx, &argc, &argv, &error)) { g_printerr ("Error parsing options: %s\n", error->message); return -1; } if (argc < 2) { g_print ("%s\n", g_option_context_get_help (optctx, TRUE, NULL)); return 1; } g_option_context_free (optctx); loop = g_main_loop_new (NULL, FALSE); /* create a server instance */ server = gst_rtsp_server_new (); g_object_set (server, "service", port, NULL); /* get the mount points for this server, every server has a default object * that be used to map uri mount points to media factories */ mounts = gst_rtsp_server_get_mount_points (server); /* make a media factory for a test stream. The default media factory can use * gst-launch syntax to create pipelines. * any launch line works as long as it contains elements named depay%d. Each * element with depay%d names will be a stream */ factory = gst_rtsp_media_factory_new (); gst_rtsp_media_factory_set_transport_mode (factory, GST_RTSP_TRANSPORT_MODE_RECORD); gst_rtsp_media_factory_set_launch (factory, argv[1]); gst_rtsp_media_factory_set_latency (factory, 2000); #ifdef WITH_TLS gst_rtsp_media_factory_set_profiles (factory, GST_RTSP_PROFILE_SAVP | GST_RTSP_PROFILE_SAVPF); #else gst_rtsp_media_factory_set_profiles (factory, GST_RTSP_PROFILE_AVP | GST_RTSP_PROFILE_AVPF); #endif /* allow user to access this resource */ gst_rtsp_media_factory_add_role (factory, "user", GST_RTSP_PERM_MEDIA_FACTORY_ACCESS, G_TYPE_BOOLEAN, TRUE, GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT, G_TYPE_BOOLEAN, TRUE, NULL); /* Anonymous users can see but not construct, so get UNAUTHORIZED */ gst_rtsp_media_factory_add_role (factory, "anonymous", GST_RTSP_PERM_MEDIA_FACTORY_ACCESS, G_TYPE_BOOLEAN, TRUE, GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT, G_TYPE_BOOLEAN, FALSE, NULL); /* attach the test factory to the /test url */ gst_rtsp_mount_points_add_factory (mounts, "/test", factory); /* don't need the ref to the mapper anymore */ g_object_unref (mounts); /* Set up the auth for user account */ /* make a new authentication manager */ auth = gst_rtsp_auth_new (); #ifdef WITH_TLS cert = g_tls_certificate_new_from_pem ("-----BEGIN CERTIFICATE-----" "MIICJjCCAY+gAwIBAgIBBzANBgkqhkiG9w0BAQUFADCBhjETMBEGCgmSJomT8ixk" "ARkWA0NPTTEXMBUGCgmSJomT8ixkARkWB0VYQU1QTEUxHjAcBgNVBAsTFUNlcnRp" "ZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAxMOY2EuZXhhbXBsZS5jb20xHTAbBgkq" "hkiG9w0BCQEWDmNhQGV4YW1wbGUuY29tMB4XDTExMDExNzE5NDcxN1oXDTIxMDEx" "NDE5NDcxN1owSzETMBEGCgmSJomT8ixkARkWA0NPTTEXMBUGCgmSJomT8ixkARkW" "B0VYQU1QTEUxGzAZBgNVBAMTEnNlcnZlci5leGFtcGxlLmNvbTBcMA0GCSqGSIb3" "DQEBAQUAA0sAMEgCQQDYScTxk55XBmbDM9zzwO+grVySE4rudWuzH2PpObIonqbf" "hRoAalKVluG9jvbHI81eXxCdSObv1KBP1sbN5RzpAgMBAAGjIjAgMAkGA1UdEwQC" "MAAwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDQYJKoZIhvcNAQEFBQADgYEAYx6fMqT1" "Gvo0jq88E8mc+bmp4LfXD4wJ7KxYeadQxt75HFRpj4FhFO3DOpVRFgzHlOEo3Fwk" "PZOKjvkT0cbcoEq5whLH25dHoQxGoVQgFyAP5s+7Vp5AlHh8Y/vAoXeEVyy/RCIH" "QkhUlAflfDMcrrYjsmwoOPSjhx6Mm/AopX4=" "-----END CERTIFICATE-----" "-----BEGIN PRIVATE KEY-----" "MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEA2EnE8ZOeVwZmwzPc" "88DvoK1ckhOK7nVrsx9j6TmyKJ6m34UaAGpSlZbhvY72xyPNXl8QnUjm79SgT9bG" "zeUc6QIDAQABAkBRFJZ32VbqWMP9OVwDJLiwC01AlYLnka0mIQZbT/2xq9dUc9GW" "U3kiVw4lL8v/+sPjtTPCYYdzHHOyDen6znVhAiEA9qJT7BtQvRxCvGrAhr9MS022" "tTdPbW829BoUtIeH64cCIQDggG5i48v7HPacPBIH1RaSVhXl8qHCpQD3qrIw3FMw" "DwIga8PqH5Sf5sHedy2+CiK0V4MRfoU4c3zQ6kArI+bEgSkCIQCLA1vXBiE31B5s" "bdHoYa1BXebfZVd+1Hd95IfEM5mbRwIgSkDuQwV55BBlvWph3U8wVIMIb4GStaH8" "W535W8UBbEg=" "-----END PRIVATE KEY-----", -1, &error); if (cert == NULL) { g_printerr ("failed to parse PEM: %s\n", error->message); return -1; } gst_rtsp_auth_set_tls_certificate (auth, cert); g_object_unref (cert); #endif /* make default token - anonymous unauthenticated access */ token = gst_rtsp_token_new (GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE, G_TYPE_STRING, "anonymous", NULL); gst_rtsp_auth_set_default_token (auth, token); gst_rtsp_token_unref (token); /* make user token */ token = gst_rtsp_token_new (GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE, G_TYPE_STRING, "user", NULL); basic = gst_rtsp_auth_make_basic ("user", "password"); gst_rtsp_auth_add_basic (auth, basic, token); g_free (basic); gst_rtsp_token_unref (token); /* set as the server authentication manager */ gst_rtsp_server_set_auth (server, auth); g_object_unref (auth); /* attach the server to the default maincontext */ gst_rtsp_server_attach (server, NULL); /* start serving */ #ifdef WITH_TLS g_print ("stream ready at rtsps://127.0.0.1:%s/test\n", port); #else g_print ("stream ready at rtsp://127.0.0.1:%s/test\n", port); #endif g_main_loop_run (loop); return 0; }
static GGZHookReturn ggz_entered(GGZServerEvent id, const void *event_data, const void *user_data) { GtkWidget *tmp; gchar *name; gchar *message; GGZRoom *room; GGZGameType *gt; /* Close any launch dialog that's currently open. */ launch_dialog_close(); /* Clear the player list */ /* We do this here so that on slower links people * don't think all the old people are in the old room */ clear_player_list(); clear_table_list(); /* Get player list */ /* FIXME: Player list should use the ggz update system */ ggzcore_room_list_tables(ggzcore_server_get_cur_room(ggz_gtk.server)); ggzcore_room_list_players(ggzcore_server_get_cur_room(ggz_gtk.server)); /* Set the room label to current room */ tmp = ggz_lookup_widget(ggz_gtk.win_main, "Current_room_label"); name = g_strdup_printf(_("Current Room: %s"), ggzcore_room_get_name (ggzcore_server_get_cur_room(ggz_gtk.server))); gtk_label_set_text(GTK_LABEL(tmp), name); g_free(name); /* Display message in chat area */ message = g_strdup_printf(_("You've joined room \"%s\"."), ggzcore_room_get_name (ggzcore_server_get_cur_room(ggz_gtk.server))); chat_display_local(CHAT_LOCAL_NORMAL, NULL, message); g_free(message); chat_display_local(CHAT_LOCAL_NORMAL, NULL, ggzcore_room_get_desc (ggzcore_server_get_cur_room(ggz_gtk.server))); /* Check what the current game type is */ room = ggzcore_server_get_cur_room(ggz_gtk.server); gt = ggzcore_room_get_gametype(room); if (ggzcore_gametype_get_name(gt) == NULL) { tmp = ggz_lookup_widget(ggz_gtk.win_main, "table_vpaned"); if (GTK_PANED(tmp)->child1_size != 0) g_object_set(G_OBJECT(tmp), "user_data", GTK_PANED(tmp)->child1_size, NULL); gtk_paned_set_position(GTK_PANED(tmp), 0); tmp = ggz_lookup_widget(ggz_gtk.win_main, "launch_button"); gtk_widget_set_sensitive(tmp, FALSE); tmp = ggz_lookup_widget(ggz_gtk.win_main, "join_button"); gtk_widget_set_sensitive(tmp, FALSE); tmp = ggz_lookup_widget(ggz_gtk.win_main, "watch_button"); gtk_widget_set_sensitive(tmp, FALSE); } else { int height; tmp = ggz_lookup_widget(ggz_gtk.win_main, "table_vpaned"); g_object_get(G_OBJECT(tmp), "user_data", &height, NULL); gtk_paned_set_position(GTK_PANED(tmp), height); tmp = ggz_lookup_widget(ggz_gtk.win_main, "launch_button"); gtk_widget_set_sensitive(tmp, TRUE); tmp = ggz_lookup_widget(ggz_gtk.win_main, "join_button"); gtk_widget_set_sensitive(tmp, TRUE); tmp = ggz_lookup_widget(ggz_gtk.win_main, "watch_button"); gtk_widget_set_sensitive(tmp, TRUE); } return GGZ_HOOK_OK; }
void cmd_javascript_windows() { g_object_set (G_OBJECT(view_settings()), "javascript-can-open-windows-automatically", uzbl.behave.javascript_windows, NULL); }
static void gimp_image_undo_pop (GimpUndo *undo, GimpUndoMode undo_mode, GimpUndoAccumulator *accum) { GimpImageUndo *image_undo = GIMP_IMAGE_UNDO (undo); GimpImage *image = undo->image; GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image); GIMP_UNDO_CLASS (parent_class)->pop (undo, undo_mode, accum); switch (undo->undo_type) { case GIMP_UNDO_IMAGE_TYPE: { GimpImageBaseType base_type; base_type = image_undo->base_type; image_undo->base_type = gimp_image_get_base_type (image); g_object_set (image, "base-type", base_type, NULL); gimp_image_colormap_changed (image, -1); if (image_undo->base_type != gimp_image_get_base_type (image)) accum->mode_changed = TRUE; } break; case GIMP_UNDO_IMAGE_PRECISION: { GimpPrecision precision; precision = image_undo->precision; image_undo->precision = gimp_image_get_precision (image); g_object_set (image, "precision", precision, NULL); if (image_undo->precision != gimp_image_get_precision (image)) accum->precision_changed = TRUE; } break; case GIMP_UNDO_IMAGE_SIZE: { gint width; gint height; gint previous_origin_x; gint previous_origin_y; gint previous_width; gint previous_height; width = image_undo->width; height = image_undo->height; previous_origin_x = image_undo->previous_origin_x; previous_origin_y = image_undo->previous_origin_y; previous_width = image_undo->previous_width; previous_height = image_undo->previous_height; /* Transform to a redo */ image_undo->width = gimp_image_get_width (image); image_undo->height = gimp_image_get_height (image); image_undo->previous_origin_x = -previous_origin_x; image_undo->previous_origin_y = -previous_origin_y; image_undo->previous_width = width; image_undo->previous_height = height; g_object_set (image, "width", width, "height", height, NULL); gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (gimp_image_get_mask (image))); if (gimp_image_get_width (image) != image_undo->width || gimp_image_get_height (image) != image_undo->height) { accum->size_changed = TRUE; accum->previous_origin_x = previous_origin_x; accum->previous_origin_y = previous_origin_y; accum->previous_width = previous_width; accum->previous_height = previous_height; } } break; case GIMP_UNDO_IMAGE_RESOLUTION: { gdouble xres; gdouble yres; gimp_image_get_resolution (image, &xres, &yres); if (ABS (image_undo->xresolution - xres) >= 1e-5 || ABS (image_undo->yresolution - yres) >= 1e-5) { private->xresolution = image_undo->xresolution; private->yresolution = image_undo->yresolution; image_undo->xresolution = xres; image_undo->yresolution = yres; accum->resolution_changed = TRUE; } }
void cmd_enforce_96dpi() { g_object_set (G_OBJECT(view_settings()), "enforce-96-dpi", uzbl.behave.enforce_96dpi, NULL); }
void cmd_caret_browsing() { g_object_set (G_OBJECT(view_settings()), "enable-caret-browsing", uzbl.behave.caret_browsing, NULL); }
void cmd_default_encoding() { g_object_set (G_OBJECT(view_settings()), "default-encoding", uzbl.behave.default_encoding, NULL); }
void cmd_resizable_txt() { g_object_set (G_OBJECT(view_settings()), "resizable-text-areas", uzbl.behave.resizable_txt, NULL); }
void cmd_style_uri() { g_object_set (G_OBJECT(view_settings()), "user-stylesheet-uri", uzbl.behave.style_uri, NULL); }
void cmd_print_bg() { g_object_set (G_OBJECT(view_settings()), "print-backgrounds", uzbl.behave.print_bg, NULL); }
void cmd_max_conns() { g_object_set(G_OBJECT(uzbl.net.soup_session), SOUP_SESSION_MAX_CONNS, uzbl.net.max_conns, NULL); }