int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *hbox, *vbox; GtkWidget *vbox2, *bbox; GtkWidget *button; GtkTreeViewColumn *column; GtkCellRenderer *cell; GtkWidget *swindow; GtkTreeModel *sample_model; gint i; gtk_init (&argc, &argv); /* First initialize all the models for signal purposes */ left_tree_model = (GtkTreeModel *) gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); sample_model = (GtkTreeModel *) gtk_list_store_new (1, G_TYPE_STRING); sample_tree_view_top = gtk_tree_view_new_with_model (sample_model); sample_tree_view_bottom = gtk_tree_view_new_with_model (sample_model); top_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_top)); bottom_right_tree_model = (GtkTreeModel *) view_column_model_new (GTK_TREE_VIEW (sample_tree_view_bottom)); top_right_tree_view = gtk_tree_view_new_with_model (top_right_tree_model); bottom_right_tree_view = gtk_tree_view_new_with_model (bottom_right_tree_model); for (i = 0; i < 10; i++) { GtkTreeIter iter; gchar *string = g_strdup_printf ("%d", i); gtk_list_store_append (GTK_LIST_STORE (sample_model), &iter); gtk_list_store_set (GTK_LIST_STORE (sample_model), &iter, 0, string, -1); g_free (string); } /* Set up the test windows. */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_default_size (GTK_WINDOW (window), 300, 300); gtk_window_set_title (GTK_WINDOW (window), "Top Window"); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (window), swindow); gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_top); gtk_widget_show_all (window); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_default_size (GTK_WINDOW (window), 300, 300); gtk_window_set_title (GTK_WINDOW (window), "Bottom Window"); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (window), swindow); gtk_container_add (GTK_CONTAINER (swindow), sample_tree_view_bottom); gtk_widget_show_all (window); /* Set up the main window */ window = gtk_window_new (GTK_WINDOW_TOPLEVEL); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_window_set_default_size (GTK_WINDOW (window), 500, 300); vbox = gtk_vbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); gtk_container_add (GTK_CONTAINER (window), vbox); hbox = gtk_hbox_new (FALSE, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); /* Left Pane */ cell = gtk_cell_renderer_text_new (); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); left_tree_view = gtk_tree_view_new_with_model (left_tree_model); gtk_container_add (GTK_CONTAINER (swindow), left_tree_view); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (left_tree_view), -1, "Unattached Columns", cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), left_tree_view); column = gtk_tree_view_column_new_with_attributes ("Visible", cell, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (left_tree_view), column); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_box_pack_start (GTK_BOX (hbox), swindow, TRUE, TRUE, 0); /* Middle Pane */ vbox2 = gtk_vbox_new (FALSE, 8); gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 0); bbox = gtk_vbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start (GTK_BOX (vbox2), bbox, TRUE, TRUE, 0); button = gtk_button_new_with_mnemonic ("<< (_Q)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), top_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (top_right_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); button = gtk_button_new_with_mnemonic (">> (_W)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), top_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); bbox = gtk_vbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD); gtk_box_pack_start (GTK_BOX (vbox2), bbox, TRUE, TRUE, 0); button = gtk_button_new_with_mnemonic ("<< (_E)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_left_clicked), bottom_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (bottom_right_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); button = gtk_button_new_with_mnemonic (">> (_R)"); gtk_widget_set_sensitive (button, FALSE); g_signal_connect (button, "clicked", G_CALLBACK (add_right_clicked), bottom_right_tree_view); g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (left_tree_view)), "changed", G_CALLBACK (selection_changed), button); gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, FALSE, 0); /* Right Pane */ vbox2 = gtk_vbox_new (FALSE, 8); gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (top_right_tree_view), FALSE); cell = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (top_right_tree_view), -1, NULL, cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), top_right_tree_view); column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (top_right_tree_view), column); gtk_container_add (GTK_CONTAINER (swindow), top_right_tree_view); gtk_box_pack_start (GTK_BOX (vbox2), swindow, TRUE, TRUE, 0); swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (bottom_right_tree_view), FALSE); cell = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (bottom_right_tree_view), -1, NULL, cell, "text", 0, NULL); cell = gtk_cell_renderer_toggle_new (); g_signal_connect (cell, "toggled", G_CALLBACK (set_visible), bottom_right_tree_view); column = gtk_tree_view_column_new_with_attributes (NULL, cell, NULL); gtk_tree_view_column_set_cell_data_func (column, cell, get_visible, NULL, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (bottom_right_tree_view), column); gtk_container_add (GTK_CONTAINER (swindow), bottom_right_tree_view); gtk_box_pack_start (GTK_BOX (vbox2), swindow, TRUE, TRUE, 0); /* Drag and Drop */ gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (left_tree_view), GDK_BUTTON1_MASK, row_targets, G_N_ELEMENTS (row_targets), GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (left_tree_view), row_targets, G_N_ELEMENTS (row_targets), GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (top_right_tree_view), GDK_BUTTON1_MASK, row_targets, G_N_ELEMENTS (row_targets), GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (top_right_tree_view), row_targets, G_N_ELEMENTS (row_targets), GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (bottom_right_tree_view), GDK_BUTTON1_MASK, row_targets, G_N_ELEMENTS (row_targets), GDK_ACTION_MOVE); gtk_tree_view_enable_model_drag_dest (GTK_TREE_VIEW (bottom_right_tree_view), row_targets, G_N_ELEMENTS (row_targets), GDK_ACTION_MOVE); gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 8); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); button = gtk_button_new_with_mnemonic ("_Add new Column"); g_signal_connect (button, "clicked", G_CALLBACK (add_clicked), left_tree_model); gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show_all (window); gtk_main (); return 0; }
static void cc_date_time_panel_init (CcDateTimePanel *self) { CcDateTimePanelPrivate *priv; gchar *objects[] = { "datetime-panel", "region-liststore", "city-liststore", "month-liststore", "city-modelfilter", "city-modelsort", NULL }; char *buttons[] = { "hour_up_button", "hour_down_button", "min_up_button", "min_down_button", "ampm_up_button", "ampm_down_button" }; GtkWidget *widget; GtkAdjustment *adjustment; GError *err = NULL; GtkTreeModelFilter *city_modelfilter; GtkTreeModelSort *city_modelsort; guint i, num_days; gboolean using_ntp; gboolean can_use_ntp; int ret; DateEndianess endianess; GError *error; priv = self->priv = DATE_TIME_PANEL_PRIVATE (self); priv->cancellable = g_cancellable_new (); error = NULL; priv->dtm = date_time_mechanism_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, "org.gnome.SettingsDaemon.DateTimeMechanism", "/", priv->cancellable, &error); if (priv->dtm == NULL) { g_warning ("could not get proxy for DateTimeMechanism: %s", error->message); g_error_free (error); } priv->builder = gtk_builder_new (); ret = gtk_builder_add_objects_from_file (priv->builder, DATADIR"/datetime.ui", objects, &err); if (ret == 0) { g_warning ("Could not load ui: %s", err ? err->message : "No reason"); if (err) g_error_free (err); return; } /* set up network time button */ error = NULL; using_ntp = can_use_ntp = FALSE; if (!date_time_mechanism_call_get_using_ntp_sync (priv->dtm, &can_use_ntp, &using_ntp, priv->cancellable, &error)) { g_warning ("Failed to get using ntp: %s", error->message); g_error_free (error); } gtk_switch_set_active (GTK_SWITCH (W("network_time_switch")), using_ntp); update_widget_state_for_ntp (self, using_ntp); g_signal_connect (W("network_time_switch"), "notify::active", G_CALLBACK (change_ntp), self); /* set up time editing widgets */ for (i = 0; i < G_N_ELEMENTS (buttons); i++) { g_signal_connect (W(buttons[i]), "clicked", G_CALLBACK (change_time), self); } /* set up date editing widgets */ priv->date = g_date_time_new_now_local (); endianess = date_endian_get_default (FALSE); reorder_date_widget (endianess, priv); /* Force the direction for the time, so that the time * is presented correctly for RTL languages */ gtk_widget_set_direction (W("table2"), GTK_TEXT_DIR_LTR); gtk_combo_box_set_active (GTK_COMBO_BOX (W ("month-combobox")), g_date_time_get_month (priv->date) - 1); g_signal_connect (G_OBJECT (W("month-combobox")), "changed", G_CALLBACK (month_year_changed), self); num_days = g_date_get_days_in_month (g_date_time_get_month (priv->date), g_date_time_get_year (priv->date)); adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_day_of_month (priv->date), 1, num_days + 1, 1, 10, 1); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (W ("day-spinbutton")), adjustment); g_signal_connect (G_OBJECT (W("day-spinbutton")), "value-changed", G_CALLBACK (day_changed), self); adjustment = (GtkAdjustment*) gtk_adjustment_new (g_date_time_get_year (priv->date), G_MINDOUBLE, G_MAXDOUBLE, 1, 10, 1); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (W ("year-spinbutton")), adjustment); g_signal_connect (G_OBJECT (W("year-spinbutton")), "value-changed", G_CALLBACK (month_year_changed), self); /* set up timezone map */ priv->map = widget = (GtkWidget *) cc_timezone_map_new (); gtk_widget_show (widget); gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->builder, "aspectmap")), widget); gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (gtk_builder_get_object (priv->builder, "datetime-panel"))); /* setup the time itself */ priv->clock_tracker = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL); g_signal_connect (priv->clock_tracker, "notify::clock", G_CALLBACK (on_clock_changed), self); priv->settings = g_settings_new (CLOCK_SCHEMA); clock_settings_changed_cb (priv->settings, CLOCK_FORMAT_KEY, self); g_signal_connect (priv->settings, "changed::" CLOCK_FORMAT_KEY, G_CALLBACK (clock_settings_changed_cb), self); g_signal_connect (W("24h_button"), "notify::active", G_CALLBACK (change_clock_settings), self); update_time (self); priv->locations = (GtkTreeModel*) gtk_builder_get_object (priv->builder, "region-liststore"); load_regions_model (GTK_LIST_STORE (priv->locations), GTK_LIST_STORE (gtk_builder_get_object (priv->builder, "city-liststore"))); city_modelfilter = GTK_TREE_MODEL_FILTER (gtk_builder_get_object (priv->builder, "city-modelfilter")); widget = (GtkWidget*) gtk_builder_get_object (priv->builder, "region_combobox"); city_modelsort = GTK_TREE_MODEL_SORT (gtk_builder_get_object (priv->builder, "city-modelsort")); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (city_modelsort), CITY_COL_CITY_TRANSLATED, GTK_SORT_ASCENDING); gtk_tree_model_filter_set_visible_func (city_modelfilter, (GtkTreeModelFilterVisibleFunc) city_model_filter_func, widget, NULL); /* After the initial setup, so we can be sure that * the model is filled up */ date_time_mechanism_call_get_timezone (priv->dtm, priv->cancellable, get_timezone_cb, self); /* add the lock button */ priv->permission = polkit_permission_new_sync ("org.gnome.settingsdaemon.datetimemechanism.configure", NULL, NULL, NULL); if (priv->permission == NULL) { g_warning ("Your system does not have the '%s' PolicyKit files installed. Please check your installation", "org.gnome.settingsdaemon.datetimemechanism.configure"); return; } g_signal_connect (priv->permission, "notify", G_CALLBACK (on_permission_changed), self); on_permission_changed (priv->permission, NULL, self); }
#define WINDOW_MIN_WIDTH 300 #define WINDOW_MIN_HEIGHT 200 #define WINDOW_NUM_COLUMNS 47 #define WINDOW_NUM_ROWS 20 G_DEFINE_TYPE (GdictApplet, gdict_applet, PANEL_TYPE_APPLET); static const GtkTargetEntry drop_types[] = { { "text/plain", 0, 0 }, { "TEXT", 0, 0 }, { "STRING", 0, 0 }, { "UTF8_STRING", 0, 0 }, }; static const guint n_drop_types = G_N_ELEMENTS (drop_types); static void set_atk_name_description (GtkWidget *widget, const char *name, const char *description) { AtkObject *aobj; aobj = gtk_widget_get_accessible (widget); if (!GTK_IS_ACCESSIBLE (aobj)) return; atk_object_set_name (aobj, name); atk_object_set_description (aobj, description);
bool XAP_Win32Toolbar_Icons::getBitmapForIcon(HWND /*hwnd*/, UT_uint32 maxWidth, UT_uint32 maxHeight, UT_RGBColor * pColor, const char * szIconName, HBITMAP * pBitmap) { *pBitmap = NULL; XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(XAP_App::getApp()); HINSTANCE hInst = pWin32App->getInstance(); UT_uint32 range = G_N_ELEMENTS(s_nametoIdTable); UT_sint32 middle, right = range - 1, left = 0, cmp; HBITMAP dibBitmap = NULL; // load in our image as a DIB while (left <= right) { middle = (left + right) >> 1; cmp = g_ascii_strcasecmp(szIconName, s_nametoIdTable[middle].name); if (cmp == 0) { dibBitmap = (HBITMAP) LoadImage (hInst, MAKEINTRESOURCE (s_nametoIdTable[middle].id), IMAGE_BITMAP, maxWidth, maxHeight, LR_CREATEDIBSECTION); break; } if (cmp > 0) left = middle + 1; else right = middle - 1; } // Search the toolbariconmap for ID to iconname if (dibBitmap==NULL) { // Format: ICONNAME_LANGCODE where LANGCODE code can be _XX (_yi) or _XXXA (_caES) char szBaseID[300]; strcpy(szBaseID, szIconName); char *pLast = strrchr(szBaseID, '_'); if (pLast) *pLast = '\0'; right = range - 1; left = 0; while (left <= right) { middle = (left + right) >> 1; cmp = g_ascii_strcasecmp(szBaseID, s_nametoIdTable[middle].name); if (cmp == 0) { dibBitmap = (HBITMAP) LoadImage (hInst, MAKEINTRESOURCE (s_nametoIdTable[middle].id), IMAGE_BITMAP, maxWidth, maxHeight, LR_CREATEDIBSECTION | LR_LOADTRANSPARENT); break; } if (cmp > 0) left = middle + 1; else right = middle - 1; } }
{ "pt_BR", "Alexandra Moreire <[email protected]>\n" "Adrovane Marques Kade <[email protected]>\n" "Rafael Peregrino da Silva <[email protected]>"}, { "ro", "Alex Eftimie <[email protected]>" }, { "ru", "brahmann_ <[email protected]>,\nNikita E. Shalaev <[email protected]>" }, { "sk", "Tomáš Vadina <[email protected]>" }, { "sl", "Jože Klepec <[email protected]>"}, { "sv", "Tony Mattsson <[email protected]>" }, { "sr", "Nikola Radovanovic <[email protected]>"}, { "tr", "Gürkan Gür <[email protected]>"}, { "uk", "Boris Dibrov <[email protected]>" }, { "vi_VN", "Clytie Siddall <[email protected]>" }, { "zh_CN", "Dormouse Young <[email protected]>,\nXhacker Liu <[email protected]>" }, { "zh_TW", "KoViCH <[email protected]>\nWei-Lun Chao <[email protected]>" } }; static const guint translators_len = G_N_ELEMENTS(translators); const gchar *prev_translators[][2] = { { "es", "Damián Viano <[email protected]>\nNacho Cabanes <[email protected]>" }, { "pl", "Jacek Wolszczak <[email protected]>\nJarosław Foksa <[email protected]>" }, { "nl", "Kurt De Bree <[email protected]>" } }; static const guint prev_translators_len = G_N_ELEMENTS(prev_translators); static const gchar *contributors = "Adam Ples, " "Alexander Rodin, Alexey Antipov, Andrew Rowland, Anh Phạm, blackdog, Bo Lorentsen, Bob Doan, " "Bronisław Białek, Can Koy, Catalin Marinas, " "Chris Macksey, Christoph Berg, Colomban Wendling, Conrad Steenberg, Daniel Richard G., " "Daniel Marjamaki, Dave Moore, " "Dimitar Zhekov, Dirk Weber, Elias Pschernig, Eric Forgeot, "
{ NC_("query-criteria", "Year"), RHYTHMDB_PROP_DATE, RHYTHMDB_PROP_DATE, &year_property_type }, { NC_("query-criteria", "Rating"), RHYTHMDB_PROP_RATING, RHYTHMDB_PROP_RATING, &rating_property_type }, { NC_("query-criteria", "Path"), RHYTHMDB_PROP_LOCATION, RHYTHMDB_PROP_LOCATION, &escaped_string_property_type }, { NC_("query-criteria", "Play Count"), RHYTHMDB_PROP_PLAY_COUNT, RHYTHMDB_PROP_PLAY_COUNT, &integer_property_type }, { NC_("query-criteria", "Track Number"), RHYTHMDB_PROP_TRACK_NUMBER, RHYTHMDB_PROP_TRACK_NUMBER, &integer_property_type }, { NC_("query-criteria", "Disc Number"), RHYTHMDB_PROP_DISC_NUMBER, RHYTHMDB_PROP_DISC_NUMBER, &integer_property_type }, { NC_("query-criteria", "Bitrate"), RHYTHMDB_PROP_BITRATE, RHYTHMDB_PROP_BITRATE, &integer_property_type }, { NC_("query-criteria", "Duration"), RHYTHMDB_PROP_DURATION, RHYTHMDB_PROP_DURATION, &duration_property_type }, { NC_("query-criteria", "Time of Last Play"), RHYTHMDB_PROP_LAST_PLAYED, RHYTHMDB_PROP_LAST_PLAYED, &relative_time_property_type }, { NC_("query-criteria", "Time Added to Library"), RHYTHMDB_PROP_FIRST_SEEN, RHYTHMDB_PROP_FIRST_SEEN, &relative_time_property_type }, }; const int num_property_options = G_N_ELEMENTS (property_options); /* * This table describes which properties can be used for sorting a playlist * All entries MUST have column keys column keys listed in rb-entry-view.c */ const RBQueryCreatorSortOption sort_options[] = { { NC_("query-sort", "Artist"), "Artist", N_("_In reverse alphabetical order") }, { NC_("query-sort", "Album"), "Album", N_("_In reverse alphabetical order") }, { NC_("query-sort", "Genre"), "Genre", N_("_In reverse alphabetical order") }, { NC_("query-sort", "Title"), "Title", N_("_In reverse alphabetical order") }, { NC_("query-sort", "Rating"), "Rating", N_("W_ith more highly rated tracks first") }, { NC_("query-sort", "Play Count"), "PlayCount", N_("W_ith more often played songs first") }, { NC_("query-sort", "Year"), "Year", N_("W_ith newer tracks first") }, { NC_("query-sort", "Duration"), "Time", N_("W_ith longer tracks first") },
static void activate (GApplication *app) { GtkBuilder *builder; GtkWindow *window; GtkWidget *widget; GtkTreeModel *model; GtkTreeIter iter; GError *error = NULL; GtkWidget *sw; GtkWidget *scrollbar; GtkWidget *menu; GtkWidget *item; static GActionEntry win_entries[] = { { "run", activate_run, NULL, NULL, NULL } }; builder = gtk_builder_new (); gtk_builder_add_from_resource (builder, "/ui/main.ui", &error); if (error != NULL) { g_critical ("%s", error->message); exit (1); } window = (GtkWindow *)gtk_builder_get_object (builder, "window"); gtk_application_add_window (GTK_APPLICATION (app), window); g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window); notebook = (GtkWidget *)gtk_builder_get_object (builder, "notebook"); info_view = (GtkWidget *)gtk_builder_get_object (builder, "info-textview"); source_view = (GtkWidget *)gtk_builder_get_object (builder, "source-textview"); headerbar = (GtkWidget *)gtk_builder_get_object (builder, "headerbar"); treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview"); model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); sw = (GtkWidget *)gtk_builder_get_object (builder, "source-scrolledwindow"); scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (sw)); menu = gtk_menu_new (); item = gtk_menu_item_new_with_label ("Start"); g_signal_connect (item, "activate", G_CALLBACK (start_cb), scrollbar); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); item = gtk_menu_item_new_with_label ("End"); g_signal_connect (item, "activate", G_CALLBACK (end_cb), scrollbar); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show_all (menu); g_signal_connect (scrollbar, "popup-menu", G_CALLBACK (scrollbar_popup), menu); load_file (gtk_demos[0].name, gtk_demos[0].filename); populate_model (model); g_signal_connect (treeview, "row-activated", G_CALLBACK (row_activated_cb), model); widget = (GtkWidget *)gtk_builder_get_object (builder, "treeview-selection"); g_signal_connect (widget, "changed", G_CALLBACK (selection_cb), model); gtk_tree_model_get_iter_first (gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)), &iter); gtk_tree_selection_select_iter (GTK_TREE_SELECTION (widget), &iter); gtk_tree_view_collapse_all (GTK_TREE_VIEW (treeview)); gtk_widget_show_all (GTK_WIDGET (window)); g_object_unref (builder); }
static void rspamd_html_parse_tag_content (rspamd_mempool_t *pool, struct html_content *hc, struct html_tag *tag, const guchar *in, gint *statep, guchar const **savep) { enum { parse_start = 0, parse_name, parse_attr_name, parse_equal, parse_start_dquote, parse_dqvalue, parse_end_dquote, parse_start_squote, parse_sqvalue, parse_end_squote, parse_value, spaces_after_name, spaces_before_eq, spaces_after_eq, spaces_after_param, ignore_bad_tag } state; struct html_tag_def *found; gboolean store = FALSE; struct html_tag_component *comp; state = *statep; switch (state) { case parse_start: if (!g_ascii_isalpha (*in) && !g_ascii_isspace (*in)) { hc->flags |= RSPAMD_HTML_FLAG_BAD_ELEMENTS; state = ignore_bad_tag; } else if (g_ascii_isalpha (*in)) { state = parse_name; tag->name.start = in; } break; case parse_name: if (g_ascii_isspace (*in) || *in == '>' || *in == '/') { g_assert (in >= tag->name.start); if (*in == '/') { tag->flags |= FL_CLOSED; } tag->name.len = in - tag->name.start; if (tag->name.len == 0) { hc->flags |= RSPAMD_HTML_FLAG_BAD_ELEMENTS; tag->flags |= FL_BROKEN; state = ignore_bad_tag; } else { /* We can safely modify tag's name here, as it is already parsed */ tag->name.len = rspamd_html_decode_entitles_inplace ( (gchar *)tag->name.start, tag->name.len); found = bsearch (tag, tag_defs, G_N_ELEMENTS (tag_defs), sizeof (tag_defs[0]), tag_find); if (found == NULL) { hc->flags |= RSPAMD_HTML_FLAG_UNKNOWN_ELEMENTS; tag->id = -1; } else { tag->id = found->id; tag->flags = found->flags; } state = spaces_after_name; } } break; case parse_attr_name: if (*savep == NULL) { state = ignore_bad_tag; } else { if (*in == '=') { state = parse_equal; } else if (g_ascii_isspace (*in)) { state = spaces_before_eq; } else if (*in == '/') { tag->flags |= FL_CLOSED; } else { return; } if (!rspamd_html_parse_tag_component (pool, *savep, in, tag)) { /* Ignore unknown params */ *savep = NULL; } } break; case spaces_after_name: if (!g_ascii_isspace (*in)) { *savep = in; if (*in == '/') { tag->flags |= FL_CLOSED; } else if (*in != '>') { state = parse_attr_name; } } break; case spaces_before_eq: if (*in == '=') { state = parse_equal; } else if (!g_ascii_isspace (*in)) { hc->flags |= RSPAMD_HTML_FLAG_BAD_ELEMENTS; tag->flags |= FL_BROKEN; state = ignore_bad_tag; } break; case spaces_after_eq: if (*in == '"') { state = parse_start_dquote; } else if (*in == '\'') { state = parse_start_squote; } else if (!g_ascii_isspace (*in)) { if (*savep != NULL) { /* We need to save this param */ *savep = in; } state = parse_value; } break; case parse_equal: if (g_ascii_isspace (*in)) { state = spaces_after_eq; } else if (*in == '"') { state = parse_start_dquote; } else if (*in == '\'') { state = parse_start_squote; } else { if (*savep != NULL) { /* We need to save this param */ *savep = in; } state = parse_value; } break; case parse_start_dquote: if (*in == '"') { if (*savep != NULL) { /* We have an empty attribute value */ savep = NULL; } state = spaces_after_param; } else { if (*savep != NULL) { /* We need to save this param */ *savep = in; } state = parse_dqvalue; } break; case parse_start_squote: if (*in == '\'') { if (*savep != NULL) { /* We have an empty attribute value */ savep = NULL; } state = spaces_after_param; } else { if (*savep != NULL) { /* We need to save this param */ *savep = in; } state = parse_sqvalue; } break; case parse_dqvalue: if (*in == '"') { store = TRUE; state = parse_end_dquote; } if (store) { if (*savep != NULL) { g_assert (tag->params != NULL); comp = g_queue_peek_tail (tag->params); g_assert (comp != NULL); comp->len = in - *savep; comp->start = *savep; comp->len = rspamd_html_decode_entitles_inplace ((gchar *)*savep, comp->len); *savep = NULL; } } break; case parse_sqvalue: if (*in == '\'') { store = TRUE; state = parse_end_squote; } if (store) { if (*savep != NULL) { g_assert (tag->params != NULL); comp = g_queue_peek_tail (tag->params); g_assert (comp != NULL); comp->len = in - *savep; comp->start = *savep; comp->len = rspamd_html_decode_entitles_inplace ((gchar *)*savep, comp->len); *savep = NULL; } } break; case parse_value: if (*in == '/' && *(in + 1) == '>') { tag->flags |= FL_CLOSED; store = TRUE; } else if (g_ascii_isspace (*in) || *in == '>') { store = TRUE; state = spaces_after_param; } if (store) { if (*savep != NULL) { g_assert (tag->params != NULL); comp = g_queue_peek_tail (tag->params); g_assert (comp != NULL); comp->len = in - *savep; comp->start = *savep; comp->len = rspamd_html_decode_entitles_inplace ((gchar *)*savep, comp->len); *savep = NULL; } } break; case parse_end_dquote: case parse_end_squote: if (g_ascii_isspace (*in)) { state = spaces_after_param; } break; case spaces_after_param: if (!g_ascii_isspace (*in)) { state = parse_attr_name; *savep = in; } break; case ignore_bad_tag: break; } *statep = state; }
static void chr_read(void *opaque, const uint8_t *buf, int size) { TestServer *s = opaque; CharBackend *chr = &s->chr; VhostUserMsg msg; uint8_t *p = (uint8_t *) &msg; int fd = -1; if (s->test_fail) { qemu_chr_fe_disconnect(chr); /* now switch to non-failure */ s->test_fail = false; } if (size != VHOST_USER_HDR_SIZE) { g_test_message("Wrong message size received %d\n", size); return; } g_mutex_lock(&s->data_mutex); memcpy(p, buf, VHOST_USER_HDR_SIZE); if (msg.size) { p += VHOST_USER_HDR_SIZE; size = qemu_chr_fe_read_all(chr, p, msg.size); if (size != msg.size) { g_test_message("Wrong message size received %d != %d\n", size, msg.size); return; } } switch (msg.request) { case VHOST_USER_GET_FEATURES: /* send back features to qemu */ msg.flags |= VHOST_USER_REPLY_MASK; msg.size = sizeof(m.payload.u64); msg.payload.u64 = 0x1ULL << VHOST_F_LOG_ALL | 0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES; if (s->queues > 1) { msg.payload.u64 |= 0x1ULL << VIRTIO_NET_F_MQ; } if (s->test_flags >= TEST_FLAGS_BAD) { msg.payload.u64 = 0; s->test_flags = TEST_FLAGS_END; } p = (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; case VHOST_USER_SET_FEATURES: g_assert_cmpint(msg.payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), !=, 0ULL); if (s->test_flags == TEST_FLAGS_DISCONNECT) { qemu_chr_fe_disconnect(chr); s->test_flags = TEST_FLAGS_BAD; } break; case VHOST_USER_GET_PROTOCOL_FEATURES: /* send back features to qemu */ msg.flags |= VHOST_USER_REPLY_MASK; msg.size = sizeof(m.payload.u64); msg.payload.u64 = 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; msg.payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_CROSS_ENDIAN; if (s->queues > 1) { msg.payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_MQ; } p = (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; case VHOST_USER_GET_VRING_BASE: /* send back vring base to qemu */ msg.flags |= VHOST_USER_REPLY_MASK; msg.size = sizeof(m.payload.state); msg.payload.state.num = 0; p = (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); assert(msg.payload.state.index < s->queues * 2); s->rings &= ~(0x1ULL << msg.payload.state.index); g_cond_broadcast(&s->data_cond); break; case VHOST_USER_SET_MEM_TABLE: /* received the mem table */ memcpy(&s->memory, &msg.payload.memory, sizeof(msg.payload.memory)); s->fds_num = qemu_chr_fe_get_msgfds(chr, s->fds, G_N_ELEMENTS(s->fds)); /* signal the test that it can continue */ g_cond_broadcast(&s->data_cond); break; case VHOST_USER_SET_VRING_KICK: case VHOST_USER_SET_VRING_CALL: /* consume the fd */ qemu_chr_fe_get_msgfds(chr, &fd, 1); /* * This is a non-blocking eventfd. * The receive function forces it to be blocking, * so revert it back to non-blocking. */ qemu_set_nonblock(fd); break; case VHOST_USER_SET_LOG_BASE: if (s->log_fd != -1) { close(s->log_fd); s->log_fd = -1; } qemu_chr_fe_get_msgfds(chr, &s->log_fd, 1); msg.flags |= VHOST_USER_REPLY_MASK; msg.size = 0; p = (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE); g_cond_broadcast(&s->data_cond); break; case VHOST_USER_SET_VRING_BASE: assert(msg.payload.state.index < s->queues * 2); s->rings |= 0x1ULL << msg.payload.state.index; g_cond_broadcast(&s->data_cond); break; case VHOST_USER_GET_QUEUE_NUM: msg.flags |= VHOST_USER_REPLY_MASK; msg.size = sizeof(m.payload.u64); msg.payload.u64 = s->queues; p = (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; default: break; } g_mutex_unlock(&s->data_mutex); }
{"rsquo", 8217, "'"}, {"sbquo", 8218, "\""}, {"ldquo", 8220, "\""}, {"rdquo", 8221, "\""}, {"bdquo", 8222, "\""}, {"dagger", 8224, "T"}, {"Dagger", 8225, "T"}, {"permil", 8240, NULL}, {"lsaquo", 8249, "\""}, {"rsaquo", 8250, "\""}, {"euro", 8364, "E"}, }; static GHashTable *html_colors_hash = NULL; static entity entities_defs_num[ (G_N_ELEMENTS (entities_defs)) ]; static struct html_tag_def tag_defs_num[ (G_N_ELEMENTS (tag_defs)) ]; static gint tag_cmp (const void *m1, const void *m2) { const struct html_tag_def *p1 = m1; const struct html_tag_def *p2 = m2; gsize l1, l2; l1 = strlen (p1->name); l2 = strlen (p2->name); if (l1 == l2) { return g_ascii_strcasecmp (p1->name, p2->name); }
/* Decode HTML entitles in text */ guint rspamd_html_decode_entitles_inplace (gchar *s, guint len) { guint l, rep_len; gchar *t = s, *h = s, *e = s, *end_ptr; gint state = 0, val, base; entity *found, key; if (len == 0) { l = strlen (s); } else { l = len; } while (h - s < (gint)l) { switch (state) { /* Out of entitle */ case 0: if (*h == '&') { state = 1; e = h; h++; continue; } else { *t = *h; h++; t++; } break; case 1: if (*h == ';' && h > e) { /* Determine base */ /* First find in entities table */ key.name = e + 1; *h = '\0'; if (*(e + 1) != '#' && (found = bsearch (&key, entities_defs, G_N_ELEMENTS (entities_defs), sizeof (entity), entity_cmp)) != NULL) { if (found->replacement) { rep_len = strlen (found->replacement); memcpy (t, found->replacement, rep_len); t += rep_len; } else { memmove (t, e, h - e); t += h - e; } } else if (e + 2 < h) { if (*(e + 2) == 'x' || *(e + 2) == 'X') { base = 16; } else if (*(e + 2) == 'o' || *(e + 2) == 'O') { base = 8; } else { base = 10; } if (base == 10) { val = strtoul ((e + 2), &end_ptr, base); } else { val = strtoul ((e + 3), &end_ptr, base); } if (end_ptr != NULL && *end_ptr != '\0') { /* Skip undecoded */ memmove (t, e, h - e); t += h - e; } else { /* Search for a replacement */ key.code = val; found = bsearch (&key, entities_defs_num, G_N_ELEMENTS ( entities_defs), sizeof (entity), entity_cmp_num); if (found) { if (found->replacement) { rep_len = strlen (found->replacement); memcpy (t, found->replacement, rep_len); t += rep_len; } } else { /* Unicode point */ if (g_unichar_isgraph (val)) { t += g_unichar_to_utf8 (val, t); } else { memmove (t, e, h - e); t += h - e; } } } } *h = ';'; state = 0; } h++; break; } } return (t - s); }
static void update_editor_sheet (EggToolbarEditor *editor) { gint y; GPtrArray *items; GList *to_move = NULL, *to_copy = NULL; GtkWidget *table; GtkWidget *viewport; g_return_if_fail (EGG_IS_TOOLBAR_EDITOR (editor)); /* Create new table. */ table = gtk_table_new (0, 0, TRUE); editor->priv->table = table; gtk_container_set_border_width (GTK_CONTAINER (table), 12); gtk_table_set_row_spacings (GTK_TABLE (table), 24); gtk_widget_show (table); gtk_drag_dest_set (table, GTK_DEST_DEFAULT_ALL, dest_drag_types, G_N_ELEMENTS (dest_drag_types), GDK_ACTION_MOVE | GDK_ACTION_COPY); /* Build two lists of items (one for copying, one for moving). */ items = egg_toolbars_model_get_name_avail (editor->priv->model); while (items->len > 0) { GtkWidget *item; const char *name; gint flags; name = g_ptr_array_index (items, 0); g_ptr_array_remove_index_fast (items, 0); flags = egg_toolbars_model_get_name_flags (editor->priv->model, name); if ((flags & EGG_TB_MODEL_NAME_INFINITE) == 0) { item = editor_create_item_from_name (editor, name, GDK_ACTION_MOVE); if (item != NULL) to_move = g_list_insert_sorted (to_move, item, compare_items); } else { item = editor_create_item_from_name (editor, name, GDK_ACTION_COPY); if (item != NULL) to_copy = g_list_insert_sorted (to_copy, item, compare_items); } } /* Add them to the sheet. */ y = 0; y = append_table (GTK_TABLE (table), to_move, y, 4); y = append_table (GTK_TABLE (table), to_copy, y, 4); g_list_free (to_move); g_list_free (to_copy); g_ptr_array_free (items, TRUE); /* Delete old table. */ viewport = gtk_bin_get_child (GTK_BIN (editor->priv->scrolled_window)); if (viewport) { gtk_container_remove (GTK_CONTAINER (viewport), gtk_bin_get_child (GTK_BIN (viewport))); } /* Add table to window. */ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (editor->priv->scrolled_window), table); }
static int app_help (gboolean requested, const gchar *command) { const struct help_topic *topic = NULL; GString *string; string = g_string_new (NULL); if (command) { gint i; for (i = 0; i < G_N_ELEMENTS (topics); i++) if (g_str_equal (topics[i].command, command)) topic = &topics[i]; if (!topic) { g_string_printf (string, _("Unknown command %s\n\n"), command); requested = FALSE; } } g_string_append (string, _("Usage:\n")); if (topic) { gint maxwidth; gint i; g_string_append_printf (string, "\n %s %s %s\n\n", "gapplication", topic->command, topic->synopsis ? _(topic->synopsis) : ""); g_string_append_printf (string, "%s\n\n", _(topic->description)); if (topic->synopsis) { g_string_append (string, _("Arguments:\n")); maxwidth = 0; for (i = 0; i < G_N_ELEMENTS (substvars); i++) if (strstr (topic->synopsis, substvars[i].var)) maxwidth = MAX(maxwidth, strlen (_(substvars[i].var))); for (i = 0; i < G_N_ELEMENTS (substvars); i++) if (strstr (topic->synopsis, substvars[i].var)) g_string_append_printf (string, " %-*.*s %s\n", maxwidth, maxwidth, _(substvars[i].var), _(substvars[i].description)); g_string_append (string, "\n"); } } else { gint maxwidth; gint i; g_string_append_printf (string, "\n %s %s %s\n\n", "gapplication", _("COMMAND"), _("[ARGS...]")); g_string_append_printf (string, _("Commands:\n")); maxwidth = 0; for (i = 0; i < G_N_ELEMENTS (topics); i++) maxwidth = MAX(maxwidth, strlen (topics[i].command)); for (i = 0; i < G_N_ELEMENTS (topics); i++) g_string_append_printf (string, " %-*.*s %s\n", maxwidth, maxwidth, topics[i].command, _(topics[i].summary)); g_string_append (string, "\n"); /* Translators: do not translate 'help', but please translate 'COMMAND'. */ g_string_append_printf (string, _("Use '%s help COMMAND' to get detailed help.\n\n"), "gapplication"); } if (requested) g_print ("%s", string->str); else g_printerr ("%s\n", string->str); g_string_free (string, TRUE); return requested ? 0 : 1; }
PROP_OUTPUT_MODEL, PROP_ENTRY_TYPE, PROP_BROWSER_VIEWS }; typedef struct { RhythmDBPropType type; const char *name; } BrowserPropertyInfo; static BrowserPropertyInfo browser_properties[] = { {RHYTHMDB_PROP_GENRE, N_("Genre")}, {RHYTHMDB_PROP_ARTIST, N_("Artist")}, {RHYTHMDB_PROP_ALBUM, N_("Album")} }; const int num_browser_properties = G_N_ELEMENTS (browser_properties); static void rb_library_browser_class_init (RBLibraryBrowserClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = rb_library_browser_finalize; object_class->dispose = rb_library_browser_dispose; object_class->constructed = rb_library_browser_constructed; object_class->set_property = rb_library_browser_set_property; object_class->get_property = rb_library_browser_get_property; /** * RBLibraryBrowser:db: *
"false\0" "null\0" "var\0"; static const struct { guint name_offset; guint token; } json_symbols[] = { { 0, JSON_TOKEN_TRUE }, { 5, JSON_TOKEN_FALSE }, { 11, JSON_TOKEN_NULL }, { 16, JSON_TOKEN_VAR } }; static const guint n_json_symbols = G_N_ELEMENTS (json_symbols); /* --- typedefs --- */ typedef struct _JsonScannerKey JsonScannerKey; struct _JsonScannerKey { guint scope_id; gchar *symbol; gpointer value; }; /* --- prototypes --- */ static gboolean json_scanner_key_equal (gconstpointer v1, gconstpointer v2); static guint json_scanner_key_hash (gconstpointer v);
static GdkVisualDirectFB * gdk_directfb_visual_create (DFBSurfacePixelFormat pixelformat); static DFBSurfacePixelFormat formats[] = { DSPF_ARGB, DSPF_LUT8, DSPF_RGB32, DSPF_RGB24, DSPF_RGB16, DSPF_ARGB1555, DSPF_RGB332 }; GdkVisual * system_visual = NULL; static GdkVisualDirectFB * visuals[G_N_ELEMENTS (formats) + 1] = { NULL }; static gint available_depths[G_N_ELEMENTS (formats) + 1] = {0}; static GdkVisualType available_types[G_N_ELEMENTS (formats) + 1] = {0}; static void gdk_visual_finalize (GObject *object) { g_error ("A GdkVisual object was finalized. This should not happen"); } static void gdk_visual_class_init (GObjectClass *class) { class->finalize = gdk_visual_finalize; }
gboolean show_desktop_applet_fill(MatePanelApplet* applet) { ShowDesktopData* sdd; GtkActionGroup* action_group; gchar* ui_path; AtkObject* atk_obj; mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); sdd = g_new0(ShowDesktopData, 1); sdd->applet = GTK_WIDGET(applet); sdd->image = gtk_image_new(); switch (mate_panel_applet_get_orient(applet)) { case MATE_PANEL_APPLET_ORIENT_LEFT: case MATE_PANEL_APPLET_ORIENT_RIGHT: sdd->orient = GTK_ORIENTATION_VERTICAL; break; case MATE_PANEL_APPLET_ORIENT_UP: case MATE_PANEL_APPLET_ORIENT_DOWN: default: sdd->orient = GTK_ORIENTATION_HORIZONTAL; break; } sdd->size = mate_panel_applet_get_size(MATE_PANEL_APPLET(sdd->applet)); g_signal_connect(G_OBJECT(sdd->applet), "realize", G_CALLBACK(show_desktop_applet_realized), sdd); sdd->button = gtk_toggle_button_new (); gtk_widget_set_name (sdd->button, "showdesktop-button"); gtk_rc_parse_string ("\n" " style \"showdesktop-button-style\"\n" " {\n" " GtkWidget::focus-line-width=0\n" " GtkWidget::focus-padding=0\n" " }\n" "\n" " widget \"*.showdesktop-button\" style \"showdesktop-button-style\"\n" "\n"); atk_obj = gtk_widget_get_accessible(sdd->button); atk_object_set_name (atk_obj, _("Show Desktop Button")); g_signal_connect(G_OBJECT(sdd->button), "button_press_event", G_CALLBACK(do_not_eat_button_press), NULL); g_signal_connect(G_OBJECT(sdd->button), "toggled", G_CALLBACK(button_toggled_callback), sdd); gtk_container_set_border_width(GTK_CONTAINER(sdd->button), 0); gtk_container_add(GTK_CONTAINER(sdd->button), sdd->image); gtk_container_add(GTK_CONTAINER(sdd->applet), sdd->button); g_signal_connect (G_OBJECT(sdd->button), "size_allocate", G_CALLBACK(button_size_allocated), sdd); /* FIXME: Update this comment. */ /* we have to bind change_orient before we do applet_widget_add since we need to get an initial change_orient signal to set our initial oriantation, and we get that during the _add call */ g_signal_connect(G_OBJECT (sdd->applet), "change_orient", G_CALLBACK (applet_change_orient), sdd); mate_panel_applet_set_background_widget(MATE_PANEL_APPLET (sdd->applet), GTK_WIDGET(sdd->applet)); action_group = gtk_action_group_new("ShowDesktop Applet Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, show_desktop_menu_actions, G_N_ELEMENTS (show_desktop_menu_actions), sdd); ui_path = g_build_filename(WNCK_MENU_UI_DIR, "showdesktop-menu.xml", NULL); mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(sdd->applet), ui_path, action_group); g_free(ui_path); g_object_unref(action_group); g_signal_connect(G_OBJECT(sdd->applet), "destroy", G_CALLBACK(applet_destroyed), sdd); gtk_drag_dest_set(GTK_WIDGET(sdd->button), 0, NULL, 0, 0); g_signal_connect(G_OBJECT(sdd->button), "drag_motion", G_CALLBACK (button_drag_motion), sdd); g_signal_connect(G_OBJECT(sdd->button), "drag_leave", G_CALLBACK (button_drag_leave), sdd); gtk_widget_show_all(sdd->applet); return TRUE; }
static GstFlowReturn gst_fake_sink_render (GstBaseSink * bsink, GstBuffer * buf) { GstFakeSink *sink = GST_FAKE_SINK_CAST (bsink); if (sink->num_buffers_left == 0) goto eos; if (sink->num_buffers_left != -1) sink->num_buffers_left--; if (!sink->silent) { gchar dts_str[64], pts_str[64], dur_str[64]; gchar flag_str[100]; GST_OBJECT_LOCK (sink); g_free (sink->last_message); if (GST_BUFFER_DTS (buf) != GST_CLOCK_TIME_NONE) { g_snprintf (dts_str, sizeof (dts_str), "%" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_DTS (buf))); } else { g_strlcpy (dts_str, "none", sizeof (dts_str)); } if (GST_BUFFER_PTS (buf) != GST_CLOCK_TIME_NONE) { g_snprintf (pts_str, sizeof (pts_str), "%" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_PTS (buf))); } else { g_strlcpy (pts_str, "none", sizeof (pts_str)); } if (GST_BUFFER_DURATION (buf) != GST_CLOCK_TIME_NONE) { g_snprintf (dur_str, sizeof (dur_str), "%" GST_TIME_FORMAT, GST_TIME_ARGS (GST_BUFFER_DURATION (buf))); } else { g_strlcpy (dur_str, "none", sizeof (dur_str)); } { const char *flag_list[] = { "", "", "", "", "live", "decode-only", "discont", "resync", "corrupted", "marker", "header", "gap", "droppable", "delta-unit", "tag-memory", "FIXME" }; int i; char *end = flag_str; end[0] = '\0'; for (i = 0; i < G_N_ELEMENTS (flag_list); i++) { if (GST_MINI_OBJECT_CAST (buf)->flags & (1 << i)) { strcpy (end, flag_list[i]); end += strlen (end); end[0] = ' '; end[1] = '\0'; end++; } } } sink->last_message = g_strdup_printf ("chain ******* (%s:%s) (%u bytes, dts: %s, pts: %s" ", duration: %s, offset: %" G_GINT64_FORMAT ", offset_end: %" G_GINT64_FORMAT ", flags: %08x %s) %p", GST_DEBUG_PAD_NAME (GST_BASE_SINK_CAST (sink)->sinkpad), (guint) gst_buffer_get_size (buf), dts_str, pts_str, dur_str, GST_BUFFER_OFFSET (buf), GST_BUFFER_OFFSET_END (buf), GST_MINI_OBJECT_CAST (buf)->flags, flag_str, buf); GST_OBJECT_UNLOCK (sink); gst_fake_sink_notify_last_message (sink); } if (sink->signal_handoffs) g_signal_emit (sink, gst_fake_sink_signals[SIGNAL_HANDOFF], 0, buf, bsink->sinkpad); if (sink->dump) { GstMapInfo info; gst_buffer_map (buf, &info, GST_MAP_READ); gst_util_dump_mem (info.data, info.size); gst_buffer_unmap (buf, &info); } if (sink->num_buffers_left == 0) goto eos; return GST_FLOW_OK; /* ERRORS */ eos: { GST_DEBUG_OBJECT (sink, "we are EOS"); return GST_FLOW_EOS; } }
static GstCaps * gst_rtp_h264_pay_getcaps (GstRTPBasePayload * payload, GstPad * pad, GstCaps * filter) { GstCaps *template_caps; GstCaps *allowed_caps; GstCaps *caps, *icaps; gboolean append_unrestricted; guint i; allowed_caps = gst_pad_peer_query_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload), NULL); if (allowed_caps == NULL) return NULL; template_caps = gst_static_pad_template_get_caps (&gst_rtp_h264_pay_sink_template); if (gst_caps_is_any (allowed_caps)) { caps = gst_caps_ref (template_caps); goto done; } if (gst_caps_is_empty (allowed_caps)) { caps = gst_caps_ref (allowed_caps); goto done; } caps = gst_caps_new_empty (); append_unrestricted = FALSE; for (i = 0; i < gst_caps_get_size (allowed_caps); i++) { GstStructure *s = gst_caps_get_structure (allowed_caps, i); GstStructure *new_s = gst_structure_new_empty ("video/x-h264"); const gchar *profile_level_id; profile_level_id = gst_structure_get_string (s, "profile-level-id"); if (profile_level_id && strlen (profile_level_id) == 6) { const gchar *profile; const gchar *level; long int spsint; guint8 sps[3]; spsint = strtol (profile_level_id, NULL, 16); sps[0] = spsint >> 16; sps[1] = spsint >> 8; sps[2] = spsint; profile = gst_codec_utils_h264_get_profile (sps, 3); level = gst_codec_utils_h264_get_level (sps, 3); if (profile && level) { GST_LOG_OBJECT (payload, "In caps, have profile %s and level %s", profile, level); if (!strcmp (profile, "constrained-baseline")) gst_structure_set (new_s, "profile", G_TYPE_STRING, profile, NULL); else { GValue val = { 0, }; GValue profiles = { 0, }; g_value_init (&profiles, GST_TYPE_LIST); g_value_init (&val, G_TYPE_STRING); g_value_set_static_string (&val, profile); gst_value_list_append_value (&profiles, &val); g_value_set_static_string (&val, "constrained-baseline"); gst_value_list_append_value (&profiles, &val); gst_structure_take_value (new_s, "profile", &profiles); } if (!strcmp (level, "1")) gst_structure_set (new_s, "level", G_TYPE_STRING, level, NULL); else { GValue levels = { 0, }; GValue val = { 0, }; int j; g_value_init (&levels, GST_TYPE_LIST); g_value_init (&val, G_TYPE_STRING); for (j = 0; j < G_N_ELEMENTS (all_levels); j++) { g_value_set_static_string (&val, all_levels[j]); gst_value_list_prepend_value (&levels, &val); if (!strcmp (level, all_levels[j])) break; } gst_structure_take_value (new_s, "level", &levels); } } else { /* Invalid profile-level-id means baseline */ gst_structure_set (new_s, "profile", G_TYPE_STRING, "constrained-baseline", NULL); } } else { /* No profile-level-id means baseline or unrestricted */ gst_structure_set (new_s, "profile", G_TYPE_STRING, "constrained-baseline", NULL); append_unrestricted = TRUE; } caps = gst_caps_merge_structure (caps, new_s); }
static gboolean lex_instruction (MCUSCompiler *self, MCUSInstruction *instruction, GError **error) { /* For the purposes of lexing the instruction, it consists of the following lexemes: * - mnemonic: the human-readable representation of an opcode * - (whitespace) * - optional operand: the mnemonic form of the operand * - (optional whitespace) * * In EBNF: * mnemonic ::= "MOVI" | "MOV" | "ADD" | "SUB" | ... * whitespace ::= " " | "\t" * instruction ::= mnemonic , { "," , whitespace , { whitespace } , operand } */ gchar mnemonic_string[MAX_MNEMONIC_LENGTH+1] = { '\0', }; guint i, length = 0; gchar following_section[COMPILER_ERROR_CONTEXT_LENGTH+1] = { '\0', }; const MCUSInstructionData *instruction_data = NULL; while (g_ascii_isalnum (*(self->priv->i + length)) == TRUE && length < MAX_MNEMONIC_LENGTH) { mnemonic_string[length] = *(self->priv->i + length); length++; } /* If the mnemonic was zero-length or delimited by length, rather than a non-alphabetic * character, check that the next character is acceptable whitespace; if it isn't, this * mnemonic is invalid. This catches things like labels, which will either: * - not have whitespace after them if they're shorter than the maximum mnemonic length, or * - be longer than the maximum mnemonic length. */ if (length == 0 || (*(self->priv->i + length) != ' ' && *(self->priv->i + length) != '\t' && *(self->priv->i + length) != '\n' && *(self->priv->i + length) != ';' && *(self->priv->i + length) != '\0')) { g_memmove (following_section, self->priv->i + length, COMPILER_ERROR_CONTEXT_LENGTH); self->priv->error_length = length; g_set_error (error, MCUS_COMPILER_ERROR, MCUS_COMPILER_ERROR_INVALID_MNEMONIC, _("An expected mnemonic had no length, or was not delimited by whitespace around line %u before \"%s\"."), self->priv->line_number, following_section); return FALSE; } g_debug ("Lexing suspected mnemonic \"%s\".", mnemonic_string); /* Tokenise the mnemonic string to produce an MCUSOpcode */ for (i = 0; i < G_N_ELEMENTS (mcus_instruction_data); i++) { if (strcasecmp (mnemonic_string, mcus_instruction_data[i].mnemonic) == 0) { instruction->opcode = mcus_instruction_data[i].opcode; instruction->offset = self->priv->i - self->priv->code; self->priv->i += length; instruction_data = &(mcus_instruction_data[i]); break; } } if (instruction_data == NULL) { /* Invalid mnemonic! */ g_memmove (following_section, self->priv->i + length, COMPILER_ERROR_CONTEXT_LENGTH); self->priv->error_length = length; g_set_error (error, MCUS_COMPILER_ERROR, MCUS_COMPILER_ERROR_INVALID_MNEMONIC, _("A mnemonic (\"%s\") did not exist around line %u before \"%s\"."), mnemonic_string, self->priv->line_number, following_section); return FALSE; } skip_whitespace (self, FALSE, FALSE); /* Lex the operands */ for (i = 0; i < instruction_data->arity; i++) { MCUSOperand operand; const gchar *old_i; GError *child_error = NULL; skip_whitespace (self, FALSE, (i == 0) ? FALSE : TRUE); old_i = self->priv->i; if (lex_operand (self, &operand, &child_error) == TRUE) { /* Check the operand's type is valid */ if ((instruction_data->operand_types[i] == OPERAND_LABEL && operand.type != OPERAND_CONSTANT && operand.type != OPERAND_LABEL) || (instruction_data->operand_types[i] != OPERAND_LABEL && operand.type != instruction_data->operand_types[i])) { g_memmove (following_section, self->priv->i, COMPILER_ERROR_CONTEXT_LENGTH); switch (operand.type) { case OPERAND_CONSTANT: case OPERAND_REGISTER: self->priv->error_length = 2; break; case OPERAND_INPUT: case OPERAND_OUTPUT: self->priv->error_length = 1; break; case OPERAND_LABEL: self->priv->error_length = strlen (operand.label); break; default: g_assert_not_reached (); } g_set_error (error, MCUS_COMPILER_ERROR, MCUS_COMPILER_ERROR_INVALID_OPERAND_TYPE, _("An operand was of type \"%s\" when it should've been \"%s\" around line %u before \"%s\".\n\n%s"), operand_type_to_string (operand.type), operand_type_to_string (instruction_data->operand_types[i]), self->priv->line_number, following_section, instruction_data->help); /* Restore i to before the operand so that error highlighting works correctly */ self->priv->i = old_i; return FALSE; } /* Store the operand */ instruction->operands[i] = operand; } else { /* Throw the error */ g_propagate_error (error, child_error); return FALSE; } } /* Work out the instruction's length for future use */ instruction->length = self->priv->i - self->priv->code - instruction->offset; return TRUE; }
static gboolean gst_gl_context_egl_create_context (GstGLContext * context, GstGLAPI gl_api, GstGLContext * other_context, GError ** error) { GstGLContextEGL *egl; GstGLWindow *window = NULL; EGLNativeWindowType window_handle = (EGLNativeWindowType) 0; gint i = 0; EGLint context_attrib[5]; EGLint majorVersion; EGLint minorVersion; const gchar *egl_exts; gboolean need_surface = TRUE; guintptr external_gl_context = 0; GstGLDisplay *display; egl = GST_GL_CONTEXT_EGL (context); window = gst_gl_context_get_window (context); GST_DEBUG_OBJECT (context, "Creating EGL context"); if (other_context) { if (gst_gl_context_get_gl_platform (other_context) != GST_GL_PLATFORM_EGL) { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Cannot share context with non-EGL context"); goto failure; } external_gl_context = gst_gl_context_get_gl_context (other_context); } if ((gl_api & (GST_GL_API_OPENGL | GST_GL_API_GLES2)) == GST_GL_API_NONE) { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API, "EGL supports opengl or gles2"); goto failure; } display = gst_gl_context_get_display (context); if (display->type == GST_GL_DISPLAY_TYPE_EGL) { egl->egl_display = (EGLDisplay) gst_gl_display_get_handle (display); } else { guintptr native_display = gst_gl_display_get_handle (display); if (!native_display) { GstGLWindow *window = NULL; GST_WARNING ("Failed to get a global display handle, falling back to " "per-window display handles. Context sharing may not work"); if (other_context) window = gst_gl_context_get_window (other_context); if (!window) window = gst_gl_context_get_window (context); if (window) { native_display = gst_gl_window_get_display (window); gst_object_unref (window); } } egl->egl_display = eglGetDisplay ((EGLNativeDisplayType) native_display); } gst_object_unref (display); if (eglInitialize (egl->egl_display, &majorVersion, &minorVersion)) { GST_INFO ("egl initialized, version: %d.%d", majorVersion, minorVersion); } else { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE, "Failed to initialize egl: %s", gst_gl_context_egl_get_error_string ()); goto failure; } if (gl_api & GST_GL_API_OPENGL) { /* egl + opengl only available with EGL 1.4+ */ if (majorVersion == 1 && minorVersion <= 3) { if ((gl_api & ~GST_GL_API_OPENGL) == GST_GL_API_NONE) { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_OLD_LIBS, "EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)", majorVersion, minorVersion); goto failure; } else { GST_WARNING ("EGL version (%i.%i) too old for OpenGL support, (needed at least 1.4)", majorVersion, minorVersion); if (gl_api & GST_GL_API_GLES2) { goto try_gles2; } else { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_CONFIG, "Failed to choose a suitable OpenGL API"); goto failure; } } } if (!eglBindAPI (EGL_OPENGL_API)) { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED, "Failed to bind OpenGL API: %s", gst_gl_context_egl_get_error_string ()); goto failure; } GST_INFO ("Using OpenGL"); egl->gl_api = GST_GL_API_OPENGL; } else if (gl_api & GST_GL_API_GLES2) { try_gles2: if (!eglBindAPI (EGL_OPENGL_ES_API)) { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED, "Failed to bind OpenGL|ES API: %s", gst_gl_context_egl_get_error_string ()); goto failure; } GST_INFO ("Using OpenGL|ES 2.0"); egl->gl_api = GST_GL_API_GLES2; } if (!gst_gl_context_egl_choose_config (egl, other_context, error)) { g_assert (error == NULL || *error != NULL); goto failure; } egl_exts = eglQueryString (egl->egl_display, EGL_EXTENSIONS); GST_DEBUG ("about to create gl context"); if (egl->gl_api & GST_GL_API_GLES2) { context_attrib[i++] = EGL_CONTEXT_CLIENT_VERSION; context_attrib[i++] = 2; } #if !defined(GST_DISABLE_GST_DEBUG) && defined(EGL_KHR_create_context) if (gst_gl_check_extension ("EGL_KHR_create_context", egl_exts)) { context_attrib[i++] = EGL_CONTEXT_FLAGS_KHR; context_attrib[i++] = EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR; } #endif context_attrib[i++] = EGL_NONE; egl->egl_context = eglCreateContext (egl->egl_display, egl->egl_config, (EGLContext) external_gl_context, context_attrib); #ifdef EGL_KHR_create_context if (egl->egl_context == EGL_NO_CONTEXT && egl->gl_api & GST_GL_API_GLES2 && eglGetError () != EGL_SUCCESS) { /* try without EGL_CONTEXT_FLAGS flags as it was added to * EGL_KHR_create_context for gles contexts */ int i; for (i = 0; i < G_N_ELEMENTS (context_attrib); i++) { if (context_attrib[i] == EGL_CONTEXT_FLAGS_KHR || context_attrib[i] == EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR) context_attrib[i] = EGL_NONE; } egl->egl_context = eglCreateContext (egl->egl_display, egl->egl_config, (EGLContext) external_gl_context, context_attrib); } #endif if (egl->egl_context != EGL_NO_CONTEXT) { GST_INFO ("gl context created: %" G_GUINTPTR_FORMAT, (guintptr) egl->egl_context); } else { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_CREATE_CONTEXT, "Failed to create a OpenGL context: %s", gst_gl_context_egl_get_error_string ()); goto failure; } if (other_context == NULL) { /* FIXME do we want a window vfunc ? */ #if GST_GL_HAVE_WINDOW_X11 if (GST_GL_IS_WINDOW_X11 (context->window)) { gst_gl_window_x11_create_window ((GstGLWindowX11 *) context->window); } #endif #if GST_GL_HAVE_WINDOW_WAYLAND if (GST_GL_IS_WINDOW_WAYLAND_EGL (context->window)) { gst_gl_window_wayland_egl_create_window ((GstGLWindowWaylandEGL *) context->window); } #endif #if GST_GL_HAVE_WINDOW_WIN32 if (GST_GL_IS_WINDOW_WIN32 (context->window)) { gst_gl_window_win32_create_window ((GstGLWindowWin32 *) context->window); } #endif #if GST_GL_HAVE_WINDOW_DISPMANX if (GST_GL_IS_WINDOW_DISPMANX_EGL (context->window)) { gst_gl_window_dispmanx_egl_create_window ((GstGLWindowDispmanxEGL *) context->window); } #endif } if (window) window_handle = (EGLNativeWindowType) gst_gl_window_get_window_handle (window); if (window_handle) { GST_DEBUG ("Creating EGLSurface from window_handle %p", (void *) window_handle); egl->egl_surface = eglCreateWindowSurface (egl->egl_display, egl->egl_config, window_handle, NULL); /* Store window handle for later comparision */ egl->window_handle = window_handle; } else if (!gst_gl_check_extension ("EGL_KHR_surfaceless_context", egl_exts)) { EGLint surface_attrib[7]; gint j = 0; GST_DEBUG ("Surfaceless context, creating PBufferSurface"); /* FIXME: Width/height doesn't seem to matter but we can't leave them * at 0, otherwise X11 complains about BadValue */ surface_attrib[j++] = EGL_WIDTH; surface_attrib[j++] = 1; surface_attrib[j++] = EGL_HEIGHT; surface_attrib[j++] = 1; surface_attrib[j++] = EGL_LARGEST_PBUFFER; surface_attrib[j++] = EGL_TRUE; surface_attrib[j++] = EGL_NONE; egl->egl_surface = eglCreatePbufferSurface (egl->egl_display, egl->egl_config, surface_attrib); } else { GST_DEBUG ("No surface/handle !"); egl->egl_surface = EGL_NO_SURFACE; need_surface = FALSE; } if (need_surface) { if (egl->egl_surface != EGL_NO_SURFACE) { GST_INFO ("surface created"); } else { g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED, "Failed to create window surface: %s", gst_gl_context_egl_get_error_string ()); goto failure; } } /* EGLImage functions */ if (GST_GL_CHECK_GL_VERSION (majorVersion, minorVersion, 1, 5)) { egl->eglCreateImage = gst_gl_context_get_proc_address (context, "eglCreateImage"); egl->eglDestroyImage = gst_gl_context_get_proc_address (context, "eglDestroyImage"); } else if (gst_gl_check_extension ("EGL_KHR_image_base", egl_exts)) { egl->eglCreateImage = gst_gl_context_get_proc_address (context, "eglCreateImageKHR"); egl->eglDestroyImage = gst_gl_context_get_proc_address (context, "eglDestroyImageKHR"); } if (egl->eglCreateImage == NULL || egl->eglDestroyImage == NULL) { egl->eglCreateImage = NULL; egl->eglDestroyImage = NULL; } if (window) gst_object_unref (window); return TRUE; failure: if (window) gst_object_unref (window); return FALSE; }
static void gwy_vruler_real_draw_ticks(GwyRuler *ruler, gint pixelsize, gint min_label_spacing, gint min_tick_spacing) { gdouble lower, upper, max; gint text_size, labels, i, scale_depth; gdouble range, measure, base, step, first; GwyScaleScale scale; GwySIValueFormat *format; PangoLayout *layout; PangoRectangle rect; gchar *unit_str; gint unitstr_len, j; gint width, tick_length, xthickness, ythickness; gboolean units_drawn; GtkWidget *widget; GdkGC *gc; gint digit_width, digit_xoffset; const gchar *utf8p, *utf8next; gint ascent, descent, ypos; struct { GwyScaleScale scale; double base; } tick_info[4]; widget = GTK_WIDGET(ruler); xthickness = widget->style->xthickness; ythickness = widget->style->ythickness; format = ruler->vformat; upper = ruler->upper; lower = ruler->lower; if (upper <= lower || pixelsize < 2 || pixelsize > 10000) return; max = ruler->max_size; if (max == 0) max = MAX(fabs(lower), fabs(upper)); range = upper - lower; measure = range/format->magnitude / pixelsize; max /= format->magnitude; switch (ruler->units_placement && ruler->units) { case GWY_UNITS_PLACEMENT_AT_ZERO: unit_str = g_strdup_printf("%d %s", (lower > 0) ? (gint)(lower/format->magnitude) : 0, format->units); break; default: unit_str = g_strdup_printf("%d", (gint)max); break; } layout = gtk_widget_create_pango_layout(widget, "012456789"); pango_layout_get_extents(layout, NULL, &rect); digit_width = PANGO_PIXELS(rect.width)/10 + 1; digit_xoffset = rect.x; pango_layout_set_markup(layout, unit_str, -1); pango_layout_get_extents(layout, &rect, NULL); ascent = PANGO_ASCENT(rect); descent = PANGO_DESCENT(rect); text_size = g_utf8_strlen(pango_layout_get_text(layout), -1); text_size = PANGO_PIXELS(ascent + descent)*text_size; /* reallocate unit_str with some margin */ unitstr_len = strlen(unit_str) + 16; unit_str = g_renew(gchar, unit_str, unitstr_len); /* fit as many labels as you can */ labels = floor(pixelsize/(text_size + ythickness + min_label_spacing)); labels = MAX(labels, 1); if (labels > 6) labels = 6 + (labels - 5)/2; step = range/format->magnitude / labels; base = compute_base(step, 10); step /= base; if (step >= 5.0 || base < 1.0) { scale = GWY_SCALE_1; base *= 10; } else if (step >= 2.5) scale = GWY_SCALE_5; else if (step >= 2.0) scale = GWY_SCALE_2_5; else scale = GWY_SCALE_2; step = steps[scale]; /* draw labels */ width = widget->allocation.width - 2*xthickness; units_drawn = FALSE; first = floor(lower/format->magnitude / (base*step))*base*step; for (i = 0; ; i++) { gint pos; gdouble val; val = i*step*base + first; pos = floor((val - lower/format->magnitude)/measure); if (pos >= pixelsize) break; if (pos < 0) continue; if (!units_drawn && (upper < 0 || val >= 0) && ruler->units_placement == GWY_UNITS_PLACEMENT_AT_ZERO && ruler->units) { g_snprintf(unit_str, unitstr_len, "%d %s", ROUND(val), format->units); units_drawn = TRUE; } else g_snprintf(unit_str, unitstr_len, "%d", ROUND(val)); pango_layout_set_markup(layout, unit_str, -1); utf8p = unit_str; utf8next = g_utf8_next_char(utf8p); j = 0; ypos = pos + ythickness + 1; while (*utf8p) { pango_layout_set_text(layout, utf8p, utf8next - utf8p); pango_layout_get_extents(layout, &rect, NULL); gtk_paint_layout(widget->style, ruler->backing_store, GTK_WIDGET_STATE(widget), FALSE, NULL, widget, "vruler", xthickness + 1 + PANGO_PIXELS(digit_xoffset), ypos, layout); utf8p = utf8next; utf8next = g_utf8_next_char(utf8p); ypos += PANGO_PIXELS(PANGO_ASCENT(rect) + PANGO_DESCENT(rect)) + 2; j++; } } /* draw tick marks, from smallest to largest */ scale_depth = 0; while (scale && scale_depth < (gint)G_N_ELEMENTS(tick_info)) { tick_info[scale_depth].scale = scale; tick_info[scale_depth].base = base; scale = next_scale(scale, &base, measure, min_tick_spacing); scale_depth++; } scale_depth--; gc = widget->style->fg_gc[GTK_STATE_NORMAL]; while (scale_depth > -1) { tick_length = width/(scale_depth + 1) - 2; scale = tick_info[scale_depth].scale; base = tick_info[scale_depth].base; step = steps[scale]; first = floor(lower/format->magnitude / (base*step))*base*step; for (i = 0; ; i++) { gint pos; gdouble val; val = (i + 0.000001)*step*base + first; pos = floor((val - lower/format->magnitude)/measure); if (pos >= pixelsize) break; if (pos < 0) continue; gdk_draw_line(ruler->backing_store, gc, width + xthickness - tick_length, pos, width + xthickness, pos); } scale_depth--; } g_free(unit_str); g_object_unref(layout); }
gboolean pragha_database_init_schema (PraghaDatabase *database) { gint i; const gchar *queries[] = { "PRAGMA user_version=131", "PRAGMA synchronous=OFF", "CREATE TABLE IF NOT EXISTS TRACK " "(location INT PRIMARY KEY," "track_no INT," "artist INT," "album INT," "genre INT," "year INT," "comment INT," "bitrate INT," "length INT," "channels INT," "samplerate INT," "file_type INT," "title VARCHAR(255));", "CREATE TABLE IF NOT EXISTS LOCATION " "(id INTEGER PRIMARY KEY," "name TEXT," "UNIQUE(name));", "CREATE TABLE IF NOT EXISTS MIME_TYPE " "(id INTEGER PRIMARY KEY," "name VARCHAR(255)," "UNIQUE(name));", "CREATE TABLE IF NOT EXISTS ARTIST " "(id INTEGER PRIMARY KEY," "name VARCHAR(255)," "UNIQUE(name));", "CREATE TABLE IF NOT EXISTS ALBUM " "(id INTEGER PRIMARY KEY," "name VARCHAR(255)," "UNIQUE(name));", "CREATE TABLE IF NOT EXISTS GENRE " "(id INTEGER PRIMARY KEY," "name VARCHAR(255)," "UNIQUE(name));", "CREATE TABLE IF NOT EXISTS YEAR " "(id INTEGER PRIMARY KEY," "year INT," "UNIQUE(year));", "CREATE TABLE IF NOT EXISTS COMMENT " "(id INTEGER PRIMARY KEY," "name VARCHAR(255)," "UNIQUE(name));", "CREATE TABLE IF NOT EXISTS PLAYLIST_TRACKS " "(file TEXT," "playlist INT);", "CREATE TABLE IF NOT EXISTS PLAYLIST " "(id INTEGER PRIMARY KEY," "name VARCHAR(255)," "UNIQUE(name));", "CREATE TABLE IF NOT EXISTS RADIO_TRACKS " "(uri TEXT," "radio INT);", "CREATE TABLE IF NOT EXISTS RADIO " "(id INTEGER PRIMARY KEY," "name VARCHAR(255)," "UNIQUE(name));" }; for (i = 0; i < G_N_ELEMENTS(queries); i++) { if (!pragha_database_exec_query (database, queries[i])) return FALSE; } return TRUE; }
static void cert_writer (GKeyFile *file, const char *keyfile_dir, const char *uuid, NMSetting *setting, const char *key, const GValue *value) { const char *setting_name = nm_setting_get_name (setting); NMSetting8021xCKScheme scheme; NMSetting8021xCKFormat format; const char *path = NULL, *ext = "pem"; const ObjectType *objtype = NULL; int i; for (i = 0; i < G_N_ELEMENTS (objtypes) && objtypes[i].key; i++) { if (g_strcmp0 (objtypes[i].key, key) == 0) { objtype = &objtypes[i]; break; } } g_return_if_fail (objtype != NULL); scheme = objtype->scheme_func (NM_SETTING_802_1X (setting)); if (scheme == NM_SETTING_802_1X_CK_SCHEME_PATH) { path = objtype->path_func (NM_SETTING_802_1X (setting)); g_assert (path); /* If the path is rooted in the keyfile directory, just use a * relative path instead of an absolute one. */ if (g_str_has_prefix (path, keyfile_dir)) { path += strlen (keyfile_dir); while (*path == '/') path++; } g_key_file_set_string (file, setting_name, key, path); } else if (scheme == NM_SETTING_802_1X_CK_SCHEME_BLOB) { const GByteArray *blob; gboolean success; GError *error = NULL; char *new_path; blob = objtype->blob_func (NM_SETTING_802_1X (setting)); g_assert (blob); if (objtype->format_func) { /* Get the extension for a private key */ format = objtype->format_func (NM_SETTING_802_1X (setting)); if (format == NM_SETTING_802_1X_CK_FORMAT_PKCS12) ext = "p12"; } else { /* DER or PEM format certificate? */ if (blob->len > 2 && blob->data[0] == 0x30 && blob->data[1] == 0x82) ext = "der"; } /* Write the raw data out to the standard file so that we can use paths * from now on instead of pushing around the certificate data. */ new_path = g_strdup_printf ("%s/%s-%s.%s", keyfile_dir, uuid, objtype->suffix, ext); g_assert (new_path); success = write_cert_key_file (new_path, blob, &error); if (success) { /* Write the path value to the keyfile */ g_key_file_set_string (file, setting_name, key, new_path); } else { g_warning ("Failed to write certificate/key %s: %s", new_path, error->message); g_error_free (error); } g_free (new_path); } else g_assert_not_reached (); }
/** * gnm_validation_new : * @title: will be copied. * @msg: will be copied. * @texpr0: absorb the reference to the expression (optionally %NULL). * @texpr1: absorb the reference to the expression (optionally %NULL). * * Does _NOT_ require all necessary information to be set here. * gnm_validation_set_expr can be used to change the expressions after creation, * and gnm_validation_is_ok can be used to ensure that things are properly setup. * * Returns a new @GnmValidation object that needs to be unrefed. **/ GnmValidation * gnm_validation_new (ValidationStyle style, ValidationType type, ValidationOp op, Sheet *sheet, char const *title, char const *msg, GnmExprTop const *texpr0, GnmExprTop const *texpr1, gboolean allow_blank, gboolean use_dropdown) { GnmValidation *v; int nops; g_return_val_if_fail (type >= 0, NULL); g_return_val_if_fail (type < G_N_ELEMENTS (typeinfo), NULL); g_return_val_if_fail (op >= GNM_VALIDATION_OP_NONE, NULL); g_return_val_if_fail (op < (int)G_N_ELEMENTS (opinfo), NULL); g_return_val_if_fail (IS_SHEET (sheet), NULL); switch (type) { case GNM_VALIDATION_TYPE_CUSTOM: case GNM_VALIDATION_TYPE_IN_LIST: nops = 1; if (op != GNM_VALIDATION_OP_NONE) { /* * This can happen if an .xls file was saved * as a .gnumeric. */ op = GNM_VALIDATION_OP_NONE; } break; case GNM_VALIDATION_TYPE_ANY: nops = 0; break; default: nops = (op == GNM_VALIDATION_OP_NONE) ? 0 : opinfo[op].nops; } v = g_new0 (GnmValidation, 1); v->ref_count = 1; v->title = title && title[0] ? go_string_new (title) : NULL; v->msg = msg && msg[0] ? go_string_new (msg) : NULL; dependent_managed_init (&v->deps[0], sheet); if (texpr0) { if (nops > 0) dependent_managed_set_expr (&v->deps[0], texpr0); gnm_expr_top_unref (texpr0); } dependent_managed_init (&v->deps[1], sheet); if (texpr1) { if (nops > 1) dependent_managed_set_expr (&v->deps[1], texpr1); gnm_expr_top_unref (texpr1); } v->style = style; v->type = type; v->op = op; v->allow_blank = (allow_blank != FALSE); v->use_dropdown = (use_dropdown != FALSE); return v; }
static void init_capplet (void) { GtkWidget *dialog; GtkWidget *preview; GtkWidget *treeview; GtkWidget *list_scroller; GtkWidget *activate_delay_hscale; GtkWidget *activate_delay_hbox; GtkWidget *label; GtkWidget *enabled_checkbox; GtkWidget *lock_checkbox; GtkWidget *root_warning_label; GtkWidget *preview_button; GtkWidget *gpm_button; GtkWidget *fullscreen_preview_window; GtkWidget *fullscreen_preview_previous; GtkWidget *fullscreen_preview_next; GtkWidget *fullscreen_preview_area; GtkWidget *fullscreen_preview_close; char *gtk_builder_file; gdouble activate_delay; gboolean enabled; gboolean is_writable; GSettings *settings; GError *error=NULL; gint mode; gtk_builder_file = g_build_filename (GTKBUILDERDIR, GTK_BUILDER_FILE, NULL); builder = gtk_builder_new(); if (!gtk_builder_add_from_file(builder, gtk_builder_file, &error)) { g_warning("Couldn't load builder file: %s", error->message); g_error_free(error); } g_free (gtk_builder_file); if (builder == NULL) { dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not load the main interface")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("Please make sure that the screensaver is properly installed")); gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); exit (1); } preview = GTK_WIDGET (gtk_builder_get_object (builder, "preview_area")); dialog = GTK_WIDGET (gtk_builder_get_object (builder, "prefs_dialog")); treeview = GTK_WIDGET (gtk_builder_get_object (builder, "savers_treeview")); list_scroller = GTK_WIDGET (gtk_builder_get_object (builder, "themes_scrolled_window")); activate_delay_hscale = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_hscale")); activate_delay_hbox = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_hbox")); enabled_checkbox = GTK_WIDGET (gtk_builder_get_object (builder, "enable_checkbox")); lock_checkbox = GTK_WIDGET (gtk_builder_get_object (builder, "lock_checkbox")); root_warning_label = GTK_WIDGET (gtk_builder_get_object (builder, "root_warning_label")); preview_button = GTK_WIDGET (gtk_builder_get_object (builder, "preview_button")); gpm_button = GTK_WIDGET (gtk_builder_get_object (builder, "gpm_button")); fullscreen_preview_window = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_window")); fullscreen_preview_area = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_area")); fullscreen_preview_close = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_close")); fullscreen_preview_previous = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_previous_button")); fullscreen_preview_next = GTK_WIDGET (gtk_builder_get_object (builder, "fullscreen_preview_next_button")); label = GTK_WIDGET (gtk_builder_get_object (builder, "activate_delay_label")); gtk_label_set_mnemonic_widget (GTK_LABEL (label), activate_delay_hscale); label = GTK_WIDGET (gtk_builder_get_object (builder, "savers_label")); gtk_label_set_mnemonic_widget (GTK_LABEL (label), treeview); gtk_widget_set_no_show_all (root_warning_label, TRUE); widget_set_best_colormap (preview); if (! is_program_in_path (GPM_COMMAND)) { gtk_widget_set_no_show_all (gpm_button, TRUE); gtk_widget_hide (gpm_button); } activate_delay = config_get_activate_delay (&is_writable); ui_set_delay (activate_delay); if (! is_writable) { gtk_widget_set_sensitive (activate_delay_hbox, FALSE); } g_signal_connect (activate_delay_hscale, "format-value", G_CALLBACK (format_value_callback_time), NULL); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (lock_checkbox), config_get_lock (&is_writable)); if (! is_writable) { gtk_widget_set_sensitive (lock_checkbox, FALSE); } g_signal_connect (lock_checkbox, "toggled", G_CALLBACK (lock_checkbox_toggled), NULL); enabled = config_get_enabled (&is_writable); ui_set_enabled (enabled); if (! is_writable) { gtk_widget_set_sensitive (enabled_checkbox, FALSE); } g_signal_connect (enabled_checkbox, "toggled", G_CALLBACK (enabled_checkbox_toggled), NULL); setup_list_size_constraint (list_scroller, treeview); gtk_widget_set_size_request (preview, 480, 300); gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-desktop-screensaver"); gtk_window_set_icon_name (GTK_WINDOW (fullscreen_preview_window), "screensaver"); gtk_drag_dest_set (dialog, GTK_DEST_DEFAULT_ALL, drop_types, G_N_ELEMENTS (drop_types), GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE); g_signal_connect (dialog, "drag-motion", G_CALLBACK (drag_motion_cb), NULL); g_signal_connect (dialog, "drag-leave", G_CALLBACK (drag_leave_cb), NULL); g_signal_connect (dialog, "drag-data-received", G_CALLBACK (drag_data_received_cb), NULL); gtk_widget_show_all (dialog); /* Update list of themes if using random screensaver */ settings = g_settings_new (GSETTINGS_SCHEMA); mode = g_settings_get_enum (settings, KEY_MODE); if (mode == GS_MODE_RANDOM) { gchar **list; list = get_all_theme_ids (theme_manager); g_settings_set_strv (settings, KEY_THEMES, (const gchar * const*) list); g_strfreev (list); } g_signal_connect (settings, "changed", G_CALLBACK (key_changed_cb), NULL); g_object_unref (settings); preview_clear (preview); gs_job_set_widget (job, preview); if (check_is_root_user ()) { setup_for_root_user (); } g_signal_connect (activate_delay_hscale, "value-changed", G_CALLBACK (activate_delay_value_changed_cb), NULL); g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL); g_signal_connect (preview_button, "clicked", G_CALLBACK (fullscreen_preview_start_cb), treeview); g_signal_connect (fullscreen_preview_close, "clicked", G_CALLBACK (fullscreen_preview_cancelled_cb), NULL); g_signal_connect (fullscreen_preview_previous, "clicked", G_CALLBACK (fullscreen_preview_previous_cb), NULL); g_signal_connect (fullscreen_preview_next, "clicked", G_CALLBACK (fullscreen_preview_next_cb), NULL); g_idle_add ((GSourceFunc)setup_treeview_idle, NULL); }
int url_check_word (char *word, int len) { #define D(x) (x), ((sizeof (x)) - 1) static const struct { const char *s; int len; } prefix[] = { { D("irc.") }, { D("ftp.") }, { D("www.") }, { D("irc://") }, { D("ftp://") }, { D("http://") }, { D("https://") }, { D("file://") }, { D("rtsp://") }, { D("ut2004://") }, }, suffix[] = { { D(".org") }, { D(".net") }, { D(".com") }, { D(".edu") }, { D(".html") }, { D(".info") }, { D(".name") }, }; #undef D const char *at, *dot; int i, dots; if (len > 1 && word[1] == '#' && strchr("@+^%*#", word[0])) return WORD_CHANNEL; if ((word[0] == '#' || word[0] == '&') && word[1] != '#' && word[1] != 0) return WORD_CHANNEL; for (i = 0; i < G_N_ELEMENTS(prefix); i++) { int l; l = prefix[i].len; if (len > l) { int j; /* This is pretty much strncasecmp(). */ for (j = 0; j < l; j++) { unsigned char c = word[j]; if (tolower(c) != prefix[i].s[j]) break; } if (j == l) return WORD_URL; } } at = strchr (word, '@'); /* check for email addy */ dot = strrchr (word, '.'); if (at && dot) { if (at < dot) { if (strchr (word, '*')) return WORD_HOST; else return WORD_EMAIL; } } /* check if it's an IP number */ dots = 0; for (i = 0; i < len; i++) { if (word[i] == '.' && i > 0) dots++; /* allow 127.0.0.1:80 */ else if (!isdigit ((unsigned char) word[i]) && word[i] != ':') { dots = 0; break; } } if (dots == 3) return WORD_HOST; if (len > 5) { for (i = 0; i < G_N_ELEMENTS(suffix); i++) { int l; l = suffix[i].len; if (len > l) { const unsigned char *p = &word[len - l]; int j; /* This is pretty much strncasecmp(). */ for (j = 0; j < l; j++) { if (tolower(p[j]) != suffix[i].s[j]) break; } if (j == l) return WORD_HOST; } } if (word[len - 3] == '.' && isalpha ((unsigned char) word[len - 2]) && isalpha ((unsigned char) word[len - 1])) return WORD_HOST; } return 0; }
void file_actions_setup (GimpActionGroup *group) { GimpEnumActionEntry *entries; gint n_entries; gint i; gimp_action_group_add_actions (group, "file-action", file_actions, G_N_ELEMENTS (file_actions)); gimp_action_group_add_enum_actions (group, "file-action", file_save_actions, G_N_ELEMENTS (file_save_actions), G_CALLBACK (file_save_cmd_callback)); n_entries = GIMP_GUI_CONFIG (group->gimp->config)->last_opened_size; entries = g_new0 (GimpEnumActionEntry, n_entries); for (i = 0; i < n_entries; i++) { entries[i].name = g_strdup_printf ("file-open-recent-%02d", i + 1); entries[i].icon_name = "document-open"; entries[i].label = entries[i].name; entries[i].tooltip = NULL; entries[i].value = i; entries[i].value_variable = FALSE; if (i < 9) entries[i].accelerator = g_strdup_printf ("<primary>%d", i + 1); else if (i == 9) entries[i].accelerator = g_strdup ("<primary>0"); else entries[i].accelerator = NULL; } gimp_action_group_add_enum_actions (group, NULL, entries, n_entries, G_CALLBACK (file_open_recent_cmd_callback)); for (i = 0; i < n_entries; i++) { GtkAction *action; gimp_action_group_set_action_visible (group, entries[i].name, FALSE); gimp_action_group_set_action_always_show_image (group, entries[i].name, TRUE); action = gtk_action_group_get_action (GTK_ACTION_GROUP (group), entries[i].name); g_object_set (action, "context", gimp_get_user_context (group->gimp), NULL); g_free ((gchar *) entries[i].name); if (entries[i].accelerator) g_free ((gchar *) entries[i].accelerator); } g_free (entries); g_signal_connect_object (group->gimp->documents, "add", G_CALLBACK (file_actions_last_opened_update), group, 0); g_signal_connect_object (group->gimp->documents, "remove", G_CALLBACK (file_actions_last_opened_update), group, 0); g_signal_connect_object (group->gimp->documents, "reorder", G_CALLBACK (file_actions_last_opened_reorder), group, 0); file_actions_last_opened_update (group->gimp->documents, NULL, group); /* also listen to image adding/removal so we catch the case where * the last image is closed but its display stays open. */ g_signal_connect_object (group->gimp->images, "add", G_CALLBACK (file_actions_close_all_update), group, 0); g_signal_connect_object (group->gimp->images, "remove", G_CALLBACK (file_actions_close_all_update), group, 0); file_actions_close_all_update (group->gimp->displays, NULL, group); }
static gboolean level_dialog(LevelArgs *args, const gchar *title) { enum { RESPONSE_RESET = 1 }; static const GwyEnum modes[] = { { N_("_Exclude region under mask"), LEVEL_EXCLUDE, }, { N_("Exclude region _outside mask"), LEVEL_INCLUDE, }, { N_("Use entire _image (ignore mask)"), LEVEL_NORMAL, }, }; GtkWidget *dialog, *label, *table; gint row, response; LevelControls controls; controls.args = args; dialog = gtk_dialog_new_with_buttons(title, NULL, 0, _("_Reset"), RESPONSE_RESET, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); table = gtk_table_new(12, 3, FALSE); gtk_table_set_row_spacings(GTK_TABLE(table), 2); gtk_table_set_col_spacings(GTK_TABLE(table), 6); gtk_container_set_border_width(GTK_CONTAINER(table), 4); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), table); row = 0; label = gwy_label_new_header(_("Plane Fit Mode")); gtk_table_attach(GTK_TABLE(table), label, 0, 3, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); row++; controls.mode = gwy_radio_buttons_create(modes, G_N_ELEMENTS(modes), G_CALLBACK(mode_changed_cb), &controls, args->level_mode); row = gwy_radio_buttons_attach_to_table(controls.mode, GTK_TABLE(table), 3, row); gtk_widget_show_all(dialog); do { response = gtk_dialog_run(GTK_DIALOG(dialog)); switch (response) { case GTK_RESPONSE_CANCEL: case GTK_RESPONSE_DELETE_EVENT: gtk_widget_destroy(dialog); case GTK_RESPONSE_NONE: return FALSE; break; case GTK_RESPONSE_OK: break; case RESPONSE_RESET: *args = level_defaults; gwy_radio_buttons_set_current(controls.mode, args->level_mode); break; default: g_assert_not_reached(); break; } } while (response != GTK_RESPONSE_OK); gtk_widget_destroy(dialog); return TRUE; }
"CsvImportAccountAction", "go-previous", N_("Import _Accounts from CSV..."), NULL, N_("Import Accounts from a CSV file"), G_CALLBACK (gnc_plugin_csv_import_tree_cmd) }, { "CsvImportTransAction", "go-previous", N_("Import _Transactions from CSV..."), NULL, N_("Import Transactions from a CSV file"), G_CALLBACK (gnc_plugin_csv_import_trans_cmd) }, { "CsvImportPriceAction", "go-previous", N_("Import _Prices from a CSV file..."), NULL, N_("Import Prices from a CSV file"), G_CALLBACK (gnc_plugin_csv_import_price_cmd) }, }; static guint gnc_plugin_n_actions = G_N_ELEMENTS (gnc_plugin_actions); typedef struct GncPluginCsvImportPrivate { gpointer dummy; } GncPluginCsvImportPrivate; #define GNC_PLUGIN_CSV_IMPORT_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNC_TYPE_PLUGIN_CSV_IMPORT, GncPluginCsvImportPrivate)) static GObjectClass *parent_class = NULL; GType gnc_plugin_csv_import_get_type (void) { static GType gnc_plugin_csv_import_type = 0;