/** * Migrate the old cookie lifetime preferences to the * new ones (changed in 1.3.19) */ static void migrate_cookie_prefs (void) { int new_val = 0; if (eel_gconf_key_exists (CONF_PERSISTENT_COOKIES_LIFETIME)) { return; } if (eel_gconf_get_boolean (CONF_OLD_COOKIE_WARN)) { new_val = 1; } if (eel_gconf_get_boolean (CONF_OLD_SESSION_LIFETIME)) { new_val = 2; } if (new_val) { eel_gconf_set_integer (CONF_PERSISTENT_COOKIES_LIFETIME, new_val); } }
void rb_daap_sharing_init (RBShell *shell) { g_object_ref (shell); if (eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING)) { create_share (shell); } enable_sharing_notify_id = eel_gconf_notification_add (CONF_DAAP_ENABLE_SHARING, (GConfClientNotifyFunc) enable_sharing_changed_cb, shell); require_password_notify_id = eel_gconf_notification_add (CONF_DAAP_REQUIRE_PASSWORD, (GConfClientNotifyFunc) require_password_changed_cb, shell); share_name_notify_id = eel_gconf_notification_add (CONF_DAAP_SHARE_NAME, (GConfClientNotifyFunc) share_name_changed_cb, shell); share_password_notify_id = eel_gconf_notification_add (CONF_DAAP_SHARE_PASSWORD, (GConfClientNotifyFunc) share_password_changed_cb, shell); }
GList * rb_get_plugin_paths (void) { GList *paths; char *path; paths = NULL; if (!eel_gconf_get_boolean (CONF_PLUGIN_DISABLE_USER)) { /* deprecated path, should be removed some time in the future */ path = g_build_filename (rb_dot_dir (), "plugins", NULL); paths = g_list_prepend (paths, path); path = g_build_filename (rb_user_data_dir (), "plugins", NULL); paths = g_list_prepend (paths, path); } #ifdef USE_UNINSTALLED_DIRS path = g_build_filename (UNINSTALLED_PLUGINS_LOCATION, NULL); paths = g_list_prepend (paths, path); path = g_build_filename ("..", UNINSTALLED_PLUGINS_LOCATION, NULL); paths = g_list_prepend (paths, path); #endif path = g_strdup (RB_PLUGIN_DIR); paths = g_list_prepend (paths, path); paths = g_list_reverse (paths); return paths; }
void gul_gui_connect_checkbutton_to_gconf (GtkWidget *widget, const char *pref) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), eel_gconf_get_boolean (pref)); g_signal_connect (widget, "toggled", G_CALLBACK (checkbutton_toggled_cb), (gpointer) pref); }
/** * Adds a teaoroff menuitem if there isn't one already and the gconf option is set */ void gul_gui_setup_tearoff (GtkMenuShell *ms) { gboolean has_tearoff = eel_gconf_get_boolean ("/desktop/gnome/interface/menus_have_tearoff"); if (has_tearoff && !gul_gui_menu_shell_has_tearoff (ms)) { GtkWidget *tearoff = gtk_tearoff_menu_item_new (); gtk_widget_show (tearoff); gtk_menu_shell_prepend (ms, tearoff); } }
static void convert_to_new_comment_system (void) { if (!eel_gconf_get_boolean (PREF_MIGRATE_COMMENT_SYSTEM, TRUE)) return; g_print ("converting comment system..."); visit_rc_directory_sync (RC_COMMENTS_DIR, COMMENT_EXT, "", TRUE, convert_old_comment, NULL); g_print ("done."); eel_gconf_set_boolean (PREF_MIGRATE_COMMENT_SYSTEM, FALSE); }
static void migrate_proxy_prefs (void) { const gchar *keys[][2] = {{OLD_NETWORK_HTTP_PROXY, CONF_NETWORK_HTTP_PROXY}, {OLD_NETWORK_SSL_PROXY, CONF_NETWORK_SSL_PROXY}, {OLD_NETWORK_FTP_PROXY, CONF_NETWORK_FTP_PROXY}, {OLD_NETWORK_SOCKS_PROXY, CONF_NETWORK_SOCKS_PROXY}, {OLD_NETWORK_HTTP_PROXY_PORT, CONF_NETWORK_HTTP_PROXY_PORT}, {OLD_NETWORK_SSL_PROXY_PORT, CONF_NETWORK_SSL_PROXY_PORT}, {OLD_NETWORK_FTP_PROXY_PORT, CONF_NETWORK_FTP_PROXY_PORT}, {OLD_NETWORK_SOCKS_PROXY_PORT, CONF_NETWORK_SOCKS_PROXY_PORT}, {OLD_NETWORK_PROXY_AUTO_URL, CONF_NETWORK_PROXY_AUTO_URL}, {NULL, NULL}}; int proxy_mode; const char *proxy_modes[3] = {"none", "manual", "auto"}; /* * If the proxy prefs were never migrated, and if the user * has no prefs set for the gnome-wide proxy settings, migrate * its prefs */ if (!eel_gconf_key_exists (CONF_NETWORK_PROXY_AUTO_URL) && !eel_gconf_get_boolean (CONF_NETWORK_PROXY_MIGRATED)) { GConfValue *value; int i; for (i=0; keys[i][0] != NULL; i++) { value = eel_gconf_get_value (keys[i][0]); if (value) { eel_gconf_set_value (keys[i][1], value); eel_gconf_value_free (value); } } proxy_mode = eel_gconf_get_integer (OLD_NETWORK_PROXY_MODE); if (proxy_mode < 0 || proxy_mode > 2) { proxy_mode = 0; } eel_gconf_set_string (CONF_NETWORK_PROXY_MODE, proxy_modes[proxy_mode]); } eel_gconf_set_boolean (CONF_NETWORK_PROXY_MIGRATED, TRUE); }
static void create_share (RBShell *shell) { RhythmDB *rdb; DMAPDb *db; DMAPContainerDb *container_db; RBPlaylistManager *playlist_manager; char *name; char *password; gboolean require_password; g_assert (share == NULL); rb_debug ("initialize daap sharing"); name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME); if (name == NULL || *name == '\0') { g_free (name); name = rb_daap_sharing_default_share_name (); } g_object_get (shell, "db", &rdb, "playlist-manager", &playlist_manager, NULL); db = DMAP_DB (rb_rhythmdb_dmap_db_adapter_new (rdb, RHYTHMDB_ENTRY_TYPE_SONG)); container_db = DMAP_CONTAINER_DB (rb_dmap_container_db_adapter_new (playlist_manager)); require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD); if (require_password) { password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD); } else { password = NULL; } share = daap_share_new (name, password, db, container_db, NULL); g_object_unref (db); g_object_unref (container_db); g_object_unref (rdb); g_object_unref (playlist_manager); g_free (name); g_free (password); }
static void gth_file_list_update_thumbs (GthFileList *file_list) { int i; GList *scan; thumb_loader_save_thumbnails (THUMB_LOADER (file_list->priv->thumb_loader), eel_gconf_get_boolean (PREF_SAVE_THUMBNAILS, TRUE)); thumb_loader_set_max_file_size (THUMB_LOADER (file_list->priv->thumb_loader), eel_gconf_get_integer (PREF_THUMBNAIL_LIMIT, 0)); for (i = 0; i < gth_file_view_get_images (file_list->view); i++) set_unknown_pixbuf (file_list, i); for (scan = file_list->list; scan; scan = scan->next) { FileData *fd = scan->data; fd->thumb_loaded = FALSE; fd->thumb_created = FALSE; fd->error = FALSE; } file_list->priv->load_thumbs = file_list->enable_thumbs; start_update_next_thumb (file_list); }
static void enable_sharing_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, RBShell *shell) { gboolean enabled; enabled = eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING); if (enabled) { if (share == NULL) { create_share (shell); } } else { rb_debug ("shutdown daap sharing"); if (share) { g_object_unref (share); } share = NULL; } }
static void share_password_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, RBShell *shell) { gboolean require_password; char *password; if (share == NULL) { return; } require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD); /* Don't do anything unless we require a password */ if (! require_password) { return; } password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD); g_object_set (G_OBJECT (share), "password", password, NULL); g_free (password); }
static void require_password_changed_cb (GConfClient *client, guint cnxn_id, GConfEntry *entry, RBShell *shell) { gboolean required; char *password; if (share == NULL) { return; } required = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD); if (required) { password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD); } else { password = NULL; } g_object_set (G_OBJECT (share), "password", password, NULL); g_free (password); }
static gboolean rb_plugins_engine_load_cb (GFile *file, gboolean dir, gpointer userdata) { char *plugin_path; RBPluginInfo *info; char *key_name; gboolean activate; const char *sep; plugin_path = g_file_get_path (file); sep = strrchr (plugin_path, G_DIR_SEPARATOR); if (sep == NULL) sep = plugin_path; else sep += 1; /* don't look inside version control system directories. * most are already covered by excluding hidden files/directories. */ if (dir && (g_str_has_prefix (sep, "_darcs") || g_str_has_prefix (sep, "CVS"))) { rb_debug ("not loading plugin from hidden/VCS directory %s", plugin_path); g_free (plugin_path); return FALSE; } if (dir || !g_str_has_suffix (plugin_path, PLUGIN_EXT)) { g_free (plugin_path); return TRUE; } info = rb_plugins_engine_load (plugin_path); g_free (plugin_path); if (info == NULL) return TRUE; if (g_hash_table_lookup (rb_plugins, info->location)) { rb_plugin_info_free (info); return TRUE; } g_hash_table_insert (rb_plugins, info->location, info); rb_debug ("Plugin %s loaded", info->name); key_name = g_strdup_printf (CONF_PLUGIN_ACTIVE_KEY, info->location); info->active_notification_id = eel_gconf_notification_add (key_name, (GConfClientNotifyFunc)rb_plugins_engine_plugin_active_cb, info); activate = eel_gconf_get_boolean (key_name); g_free (key_name); key_name = g_strdup_printf (CONF_PLUGIN_HIDDEN_KEY, info->location); info->visible_notification_id = eel_gconf_notification_add (key_name, (GConfClientNotifyFunc)rb_plugins_engine_plugin_visible_cb, info); info->visible = !eel_gconf_get_boolean (key_name); g_free (key_name); if (activate) rb_plugins_engine_activate_plugin (info); return TRUE; }
void ask_whether_to_trim (GtkWindow *parent_window, FileData *file, TrimResponseFunc done_func, gpointer done_data) { AskTrimData *data; char *display_name; char *msg; /* If the user disabled the warning dialog trim the image */ if (! eel_gconf_get_boolean (PREF_MSG_JPEG_MCU_WARNING, TRUE)) { if (done_func != NULL) done_func (JPEG_MCU_ACTION_TRIM, done_data); return; } /* * Image dimensions are not multiples of the jpeg minimal coding unit (mcu). * Warn about possible image distortions along one or more edges. */ data = g_new0 (AskTrimData, 1); data->done_func = done_func; data->done_data = done_data; data->parent_window = parent_window; data->parent_is_modal = FALSE; if (parent_window != NULL) { data->parent_is_modal = gtk_window_get_modal (parent_window); if (data->parent_is_modal) gtk_window_set_modal (data->parent_window, FALSE); } display_name = basename_for_display (file->path); msg = g_strdup_printf (_("Problem transforming the image: %s"), display_name); data->dialog = _gtk_message_dialog_with_checkbutton_new (parent_window, GTK_DIALOG_MODAL, GTK_STOCK_DIALOG_WARNING, msg, _("This transformation may introduce small image distortions along " "one or more edges, because the image dimensions are not multiples of 8.\n\nThe distortion " "is reversible, however. If the resulting image is unacceptable, simply apply the reverse " "transformation to return to the original image.\n\nYou can also choose to discard (or trim) any " "untransformable edge pixels. For practical use, this mode gives the best looking results, " "but the transformation is not strictly lossless anymore."), PREF_MSG_JPEG_MCU_WARNING, _("_Do not display this message again"), _("_Trim"), RESPONSE_TRIM, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); g_free (display_name); g_free (msg); g_signal_connect (G_OBJECT (data->dialog), "response", G_CALLBACK (ask_whether_to_trim_response_cb), data); gtk_widget_show (data->dialog); }
/* Create the windows. */ static void prepare_app (void) { CORBA_Object factory; gboolean use_factory = FALSE; CORBA_Environment env; GNOME_GThumb_Application app; GList *scan; factory = bonobo_activation_activate_from_id ("OAFIID:GNOME_GThumb_Application_Factory", Bonobo_ACTIVATION_FLAG_EXISTING_ONLY, NULL, NULL); if (factory != NULL) { use_factory = TRUE; CORBA_exception_init (&env); app = bonobo_activation_activate_from_id ("OAFIID:GNOME_GThumb_Application", 0, NULL, &env); } if (session_is_restored ()) { load_session (use_factory, app, &env); return; } if (ImportPhotos) { if (use_factory) GNOME_GThumb_Application_import_photos (app, &env); else gth_browser_activate_action_file_camera_import (NULL, NULL); } else if (! view_comline_catalog && (n_dir_urls == 0) && (n_file_urls == 0)) { open_browser_window (NULL, TRUE, use_factory, app, &env); } else if (view_single_image) { if (use_factory && eel_gconf_get_boolean (PREF_SINGLE_WINDOW, FALSE)) { GNOME_GThumb_Application_load_image (app, file_urls->data, &env); } else { if (UseViewer) open_viewer_window (file_urls->data, use_factory, app, &env); else open_browser_window (file_urls->data, TRUE, use_factory, app, &env); } } else if (view_comline_catalog) { char *catalog_path; char *catalog_uri; ViewFirstImage = TRUE; HideSidebar = TRUE; catalog_path = get_command_line_catalog_path (); catalog_uri = g_strconcat ("catalog://", remove_host_from_uri (catalog_path), NULL); open_browser_window (catalog_uri, TRUE, use_factory, app, &env); g_free (catalog_path); g_free (catalog_uri); } for (scan = dir_urls; scan; scan = scan->next) { /* Go to the specified directory. */ open_browser_window (scan->data, TRUE, use_factory, app, &env); } path_list_free (file_urls); path_list_free (dir_urls); /**/ if (use_factory) { bonobo_object_release_unref (app, &env); CORBA_exception_free (&env); gdk_notify_startup_complete (); exit (0); } else gth_application = gth_application_new (gdk_screen_get_default ()); }
nsresult HeaderSniffer::PerformSave (const GulCString &defaultFileName) { EmbedPersistFlags flags; PRBool askDownloadDest; flags = galeon_embed_persist_get_flags (mEmbedPersist); askDownloadDest = (flags & EMBED_PERSIST_ASK_DESTINATION) || eel_gconf_get_boolean (CONF_DOWNLOADING_ASK_DIR); /* Validate the file name to ensure legality. */ char *default_name = g_strdup (defaultFileName.get()); default_name = g_strdelimit (default_name, ":/", ' '); char *filename; filename = gnome_vfs_unescape_string (default_name, NULL); if (!g_utf8_validate (filename, -1, NULL)) { g_free (filename); filename = g_strdup (default_name); } g_free (default_name); GtkWidget *parent; parent = galeon_embed_persist_get_fc_parent (mEmbedPersist); if (!askDownloadDest) { nsCOMPtr<nsILocalFile> destFile; nsresult rv = BuildDownloadPath (filename, parent, getter_AddRefs (destFile)); if (NS_SUCCEEDED (rv)) { g_free (filename); return InitiateDownload (destFile); } } GulFileChooser *dialog; const char *title; title = galeon_embed_persist_get_fc_title (mEmbedPersist); dialog = gul_file_chooser_new (title ? title: _("Save"), GTK_WIDGET (parent), GTK_FILE_CHOOSER_ACTION_SAVE, CONF_STATE_LAST_DOWNLOAD_DIR); if (mDocument && (flags & EMBED_PERSIST_SAVE_CONTENT)) { /* Reset the flags to turn off content, the user toggles * if they want to turn it on */ GtkWidget *toggle; int f = flags & ~EMBED_PERSIST_SAVE_CONTENT; flags = (EmbedPersistFlags) f; galeon_embed_persist_set_flags (mEmbedPersist, flags); toggle = gtk_check_button_new_with_mnemonic (_("Save _with content")); gtk_widget_show (toggle); gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), toggle); g_signal_connect (toggle, "toggled", G_CALLBACK (content_toggled_cb), mEmbedPersist); } gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename); NS_ADDREF (this); /* add a ref to this object, so it doesn't dissappear */ g_signal_connect (dialog, "response", G_CALLBACK (filechooser_response_cb), this); guint32 user_time; g_object_get (mEmbedPersist, "user_time", &user_time, NULL); if (!user_time) { g_warning ("No user time specified in embed persist for file save" ); } gul_x11_window_update_user_time (GTK_WIDGET (dialog), user_time); gtk_widget_show (GTK_WIDGET (dialog)); g_free (filename); return NS_OK; }
/* static */ nsresult GeckoPrintService::TranslateSettings (GtkPrintSettings *aGtkSettings, GtkPageSetup *aPageSetup, GtkPrinter *aPrinter, const nsACString &aSourceFile, PRInt16 aPrintFrames, PRBool aIsForPrinting, nsIPrintSettings *aSettings) { NS_ENSURE_ARG (aGtkSettings); NS_ENSURE_ARG (aPageSetup); GtkPrintCapabilities capabilities = GtkPrintCapabilities (0); if (aIsForPrinting) { NS_ENSURE_TRUE (aPrinter, NS_ERROR_FAILURE); capabilities = gtk_printer_get_capabilities (aPrinter); } /* Initialisation */ aSettings->SetIsInitializedFromPrinter (PR_FALSE); /* FIXME: PR_TRUE? */ aSettings->SetIsInitializedFromPrefs (PR_FALSE); /* FIXME: PR_TRUE? */ aSettings->SetPrintSilent (PR_FALSE); aSettings->SetShowPrintProgress (PR_TRUE); /* We always print PS to a file and then hand that off to gtk-print */ aSettings->SetPrinterName (LITERAL ("PostScript/default")); if (aIsForPrinting) { aSettings->SetPrintToFile (PR_TRUE); nsString sourceFile; NS_CStringToUTF16 (aSourceFile, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, sourceFile); aSettings->SetToFileName (sourceFile.get ()); } else { /* Otherwise mozilla will create the file nevertheless and * fail since we haven't set a name! */ aSettings->SetPrintToFile (PR_FALSE); } /* This is the time between printing each page, in ms. * It 'gives the user more time to press cancel' ! * We don't want any of this nonsense, so set this to a low value, * just enough to update the print dialogue. */ aSettings->SetPrintPageDelay (50); if (aIsForPrinting) { #ifdef HAVE_NSIPRINTSETTINGS_SETOUTPUTFORMAT NS_ENSURE_TRUE (aPrinter, NS_ERROR_FAILURE); const char *format = gtk_print_settings_get (aGtkSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT); if (!format) format = "ps"; if (strcmp (format, "pdf") == 0 && gtk_printer_accepts_pdf (aPrinter)) { aSettings->SetOutputFormat (nsIPrintSettings::kOutputFormatPDF); } else if (strcmp (format, "ps") == 0 && gtk_printer_accepts_ps (aPrinter)) { aSettings->SetOutputFormat (nsIPrintSettings::kOutputFormatPS); } else { g_warning ("Output format '%s' specified, but printer '%s' does not support it!", format, gtk_printer_get_name (aPrinter)); return NS_ERROR_FAILURE; } #endif int n_copies = gtk_print_settings_get_n_copies (aGtkSettings); if (n_copies <= 0) return NS_ERROR_FAILURE; if (capabilities & GTK_PRINT_CAPABILITY_COPIES) { aSettings->SetNumCopies (1); } else { /* We have to copy them ourself */ aSettings->SetNumCopies (n_copies); gtk_print_settings_set_n_copies (aGtkSettings, 1); } gboolean reverse = gtk_print_settings_get_reverse (aGtkSettings); if (capabilities & GTK_PRINT_CAPABILITY_REVERSE) { aSettings->SetPrintReversed (PR_FALSE); } else { aSettings->SetPrintReversed (reverse); gtk_print_settings_set_reverse (aGtkSettings, FALSE); } GtkPageSet pageSet = gtk_print_settings_get_page_set (aGtkSettings); aSettings->SetPrintOptions (nsIPrintSettings::kPrintEvenPages, pageSet != GTK_PAGE_SET_ODD); aSettings->SetPrintOptions (nsIPrintSettings::kPrintEvenPages, pageSet != GTK_PAGE_SET_EVEN); GtkPrintPages printPages = gtk_print_settings_get_print_pages (aGtkSettings); switch (printPages) { case GTK_PRINT_PAGES_RANGES: { int numRanges = 0; GtkPageRange *pageRanges = gtk_print_settings_get_page_ranges (aGtkSettings, &numRanges); if (numRanges > 0) { /* FIXME: We can only support one range, ignore more ranges or raise error? */ aSettings->SetPrintRange (nsIPrintSettings::kRangeSpecifiedPageRange); /* Gecko page numbers start at 1, while gtk page numbers start at 0 */ aSettings->SetStartPageRange (pageRanges[0].start + 1); aSettings->SetEndPageRange (pageRanges[0].end + 1); g_free (pageRanges); break; } /* Fall-through to PAGES_ALL */ } case GTK_PRINT_PAGES_CURRENT: /* not supported, fall through */ case GTK_PRINT_PAGES_ALL: aSettings->SetPrintRange (nsIPrintSettings::kRangeAllPages); break; /* FIXME: we need some custom ranges here, "Selection" and "Focused Frame" */ } } else { aSettings->SetPrintOptions (nsIPrintSettings::kPrintEvenPages, PR_TRUE); aSettings->SetPrintOptions (nsIPrintSettings::kPrintEvenPages, PR_TRUE); aSettings->SetPrintReversed (PR_FALSE); aSettings->SetPrintRange (nsIPrintSettings::kRangeAllPages); } /* And clear those in the settings, so the printer doesn't try to apply them too */ gtk_print_settings_set_print_pages (aGtkSettings, GTK_PRINT_PAGES_ALL); gtk_print_settings_set_page_ranges (aGtkSettings, NULL, 0); gtk_print_settings_set_page_set (aGtkSettings, GTK_PAGE_SET_ALL); /* We must use the page setup here instead of the print settings, see gtk bug #485685 */ switch (gtk_page_setup_get_orientation (aPageSetup)) { case GTK_PAGE_ORIENTATION_PORTRAIT: case GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT: /* not supported */ aSettings->SetOrientation (nsIPrintSettings::kPortraitOrientation); break; case GTK_PAGE_ORIENTATION_LANDSCAPE: case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE: /* not supported */ aSettings->SetOrientation (nsIPrintSettings::kLandscapeOrientation); break; } aSettings->SetPrintInColor (gtk_print_settings_get_use_color (aGtkSettings)); aSettings->SetPaperSizeUnit(nsIPrintSettings::kPaperSizeMillimeters); #ifdef HAVE_NSIPRINTSETTINGS_SETPAPERSIZE aSettings->SetPaperSize (nsIPrintSettings::kPaperSizeDefined); #endif GtkPaperSize *paperSize = gtk_page_setup_get_paper_size (aPageSetup); if (!paperSize) { return NS_ERROR_FAILURE; } aSettings->SetPaperSizeType (nsIPrintSettings::kPaperSizeDefined); aSettings->SetPaperWidth (gtk_paper_size_get_width (paperSize, GTK_UNIT_MM)); aSettings->SetPaperHeight (gtk_paper_size_get_height (paperSize, GTK_UNIT_MM)); #ifdef HAVE_NSIPRINTSETTINGS_SETPAPERNAME aSettings->SetPaperName (NS_ConvertUTF8toUTF16 (gtk_paper_size_get_name (paperSize)).get ()); #else { /* Mozilla bug https://bugzilla.mozilla.org/show_bug.cgi?id=307404 * means that we cannot actually use any paper sizes except mozilla's * builtin list, and we must refer to them *by name*! */ static const struct { const char gtkPaperName[13]; const char mozPaperName[10]; } paperTable [] = { { GTK_PAPER_NAME_A5, "A5" }, { GTK_PAPER_NAME_A4, "A4" }, { GTK_PAPER_NAME_A3, "A3" }, { GTK_PAPER_NAME_LETTER, "Letter" }, { GTK_PAPER_NAME_LEGAL, "Legal" }, { GTK_PAPER_NAME_EXECUTIVE, "Executive" }, }; const char *paperName = gtk_paper_size_get_name (paperSize); PRUint32 i; for (i = 0; i < G_N_ELEMENTS (paperTable); i++) { if (g_ascii_strcasecmp (paperTable[i].gtkPaperName, paperName) == 0) { paperName = paperTable[i].mozPaperName; break; } } if (i == G_N_ELEMENTS (paperTable)) { /* Not in table, fall back to A4 */ g_warning ("Unknown paper name '%s', falling back to A4", gtk_paper_size_get_name (paperSize)); paperName = paperTable[1].mozPaperName; } aSettings->SetPaperName (NS_ConvertUTF8toUTF16 (paperName).get ()); } #endif /* !HAVE_NSIPRINTSETTINGS_SETPAPERNAME */ /* Sucky mozilla wants margins in inch! */ aSettings->SetMarginTop (gtk_page_setup_get_top_margin (aPageSetup, GTK_UNIT_INCH)); aSettings->SetMarginBottom (gtk_page_setup_get_bottom_margin (aPageSetup, GTK_UNIT_INCH)); aSettings->SetMarginLeft (gtk_page_setup_get_left_margin (aPageSetup, GTK_UNIT_INCH)); aSettings->SetMarginRight (gtk_page_setup_get_right_margin (aPageSetup, GTK_UNIT_INCH)); aSettings->SetHeaderStrLeft (eel_gconf_get_boolean (CONF_PRINT_PAGE_TITLE) ? LITERAL ("&T") : LITERAL ("")); aSettings->SetHeaderStrCenter (LITERAL ("")); aSettings->SetHeaderStrRight (eel_gconf_get_boolean (CONF_PRINT_PAGE_URL) ? LITERAL ("&U") : LITERAL ("")); aSettings->SetFooterStrLeft (eel_gconf_get_boolean (CONF_PRINT_PAGE_NUMBERS) ? LITERAL ("&PT") : LITERAL ("")); aSettings->SetFooterStrCenter (LITERAL ("")); aSettings->SetFooterStrRight (eel_gconf_get_boolean (CONF_PRINT_DATE) ? LITERAL ("&D") : LITERAL ("")); aSettings->SetPrintFrameType (aPrintFrames); aSettings->SetPrintFrameTypeUsage (nsIPrintSettings::kUseSettingWhenPossible); /* FIXME: only if GTK_PRINT_CAPABILITY_SCALE is not set? */ aSettings->SetScaling (gtk_print_settings_get_scale (aGtkSettings) / 100.0); gtk_print_settings_set_scale (aGtkSettings, 1.0); aSettings->SetShrinkToFit (PR_FALSE); /* FIXME setting */ aSettings->SetPrintBGColors (eel_gconf_get_boolean (CONF_PRINT_BG_COLORS) != FALSE); aSettings->SetPrintBGImages (eel_gconf_get_boolean (CONF_PRINT_BG_IMAGES) != FALSE); /* aSettings->SetPlexName (LITERAL ("default")); */ /* aSettings->SetColorspace (LITERAL ("default")); */ /* aSettings->SetResolutionName (LITERAL ("default")); */ /* aSettings->SetDownloadFonts (PR_TRUE); */ /* Unset those setting that we can handle, so they don't get applied * again for the print job. */ /* gtk_print_settings_set_collate (aGtkSettings, FALSE); not yet */ /* FIXME: Unset the orientation for the print job? */ /* gtk_page_setup_set_orientation (aPageSetup, GTK_PAGE_ORIENTATION_PORTRAIT); */ /* FIXME: unset output format -> "ps" ? */ return NS_OK; }
void gth_browser_activate_action_view_slideshow (GtkAction *action, GthBrowser *browser) { GList *items; GList *file_list; GthProjector *projector; GtkWidget *slideshow; GthFileData *location; char *transition_id; GList *transitions = NULL; items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser))); if ((items == NULL) || (items->next == NULL)) file_list = gth_file_store_get_visibles (GTH_FILE_STORE (gth_browser_get_file_store (browser))); else file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items); projector = NULL; #ifdef HAVE_CLUTTER if (ClutterInitResult == CLUTTER_INIT_SUCCESS) projector = &clutter_projector; #endif /* HAVE_CLUTTER */ if (projector == NULL) projector = &default_projector; slideshow = gth_slideshow_new (projector, browser, file_list); location = gth_browser_get_location_data (browser); if (g_file_info_get_attribute_boolean (location->info, "slideshow::personalize")) { gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_int32 (location->info, "slideshow::delay")); gth_slideshow_set_automatic (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::automatic")); gth_slideshow_set_wrap_around (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_boolean (location->info, "slideshow::wrap-around")); transition_id = g_strdup (g_file_info_get_attribute_string (location->info, "slideshow::transition")); } else { gth_slideshow_set_delay (GTH_SLIDESHOW (slideshow), (guint) (1000.0 * eel_gconf_get_float (PREF_SLIDESHOW_CHANGE_DELAY, 5.0))); gth_slideshow_set_automatic (GTH_SLIDESHOW (slideshow), eel_gconf_get_boolean (PREF_SLIDESHOW_AUTOMATIC, TRUE)); gth_slideshow_set_wrap_around (GTH_SLIDESHOW (slideshow), eel_gconf_get_boolean (PREF_SLIDESHOW_WRAP_AROUND, FALSE)); transition_id = eel_gconf_get_string (PREF_SLIDESHOW_TRANSITION, DEFAULT_TRANSITION); } if (g_file_info_get_attribute_status (location->info, "slideshow::playlist") == G_FILE_ATTRIBUTE_STATUS_SET) gth_slideshow_set_playlist (GTH_SLIDESHOW (slideshow), g_file_info_get_attribute_stringv (location->info, "slideshow::playlist")); if (strcmp (transition_id, "random") == 0) { GList *scan; transitions = gth_main_get_registered_objects (GTH_TYPE_TRANSITION); for (scan = transitions; scan; scan = scan->next) { GthTransition *transition = scan->data; if (strcmp (gth_transition_get_id (transition), "none") == 0) { transitions = g_list_remove_link (transitions, scan); _g_object_list_unref (scan); break; } } } else { GthTransition *transition = gth_main_get_registered_object (GTH_TYPE_TRANSITION, transition_id); if (transition != NULL) transitions = g_list_append (NULL, transition); else transitions = NULL; } gth_slideshow_set_transitions (GTH_SLIDESHOW (slideshow), transitions); gtk_window_fullscreen (GTK_WINDOW (slideshow)); /*gtk_window_set_default_size (GTK_WINDOW (slideshow), 700, 700);*/ gtk_window_present (GTK_WINDOW (slideshow)); _g_object_list_unref (transitions); g_free (transition_id); _g_object_list_unref (file_list); _gtk_tree_path_list_free (items); }
void image_viewer__dlg_preferences_construct_cb (GtkWidget *dialog, GthBrowser *browser, GtkBuilder *dialog_builder) { BrowserData *data; GtkWidget *notebook; GtkWidget *page; GtkWidget *label; data = g_new0 (BrowserData, 1); data->builder = _gtk_builder_new_from_file ("image-viewer-preferences.ui", "image_viewer"); notebook = _gtk_builder_get_widget (dialog_builder, "notebook"); page = _gtk_builder_get_widget (data->builder, "preferences_page"); gtk_widget_show (page); data->change_zoom_combobox = _gtk_combo_box_new_with_texts (_("Set to actual size"), _("Keep previous zoom"), _("Fit to window"), _("Fit to window if larger"), _("Fit to width"), _("Fit to width if larger"), NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (data->change_zoom_combobox), eel_gconf_get_enum (PREF_ZOOM_CHANGE, GTH_TYPE_ZOOM_CHANGE, GTH_ZOOM_CHANGE_FIT_SIZE_IF_LARGER)); gtk_widget_show (data->change_zoom_combobox); gtk_container_add (GTK_CONTAINER (_gtk_builder_get_widget (data->builder, "zoom_change_box")), data->change_zoom_combobox); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (_gtk_builder_get_widget (data->builder, "toggle_reset_scrollbars")), eel_gconf_get_boolean (PREF_RESET_SCROLLBARS, TRUE)); data->transp_type_combobox = _gtk_combo_box_new_with_texts (_("White"), _("None"), _("Black"), _("Checked"), NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (data->transp_type_combobox), eel_gconf_get_enum (PREF_TRANSP_TYPE, GTH_TYPE_TRANSP_TYPE, GTH_TRANSP_TYPE_NONE)); gtk_widget_show (data->transp_type_combobox); gtk_container_add (GTK_CONTAINER (_gtk_builder_get_widget (data->builder, "transp_type_box")), data->transp_type_combobox); gtk_combo_box_set_active (GTK_COMBO_BOX (_gtk_builder_get_widget (data->builder, "zoom_quality_combobox")), eel_gconf_get_enum (PREF_ZOOM_QUALITY, GTH_TYPE_ZOOM_QUALITY, GTH_ZOOM_QUALITY_LOW)); g_signal_connect (_gtk_builder_get_widget (data->builder, "zoom_quality_combobox"), "changed", G_CALLBACK (zoom_quality_changed_cb), data); g_signal_connect (G_OBJECT (data->change_zoom_combobox), "changed", G_CALLBACK (zoom_change_changed_cb), data); g_signal_connect (G_OBJECT (data->transp_type_combobox), "changed", G_CALLBACK (transp_type_changed_cb), data); g_signal_connect (G_OBJECT (_gtk_builder_get_widget (data->builder, "toggle_reset_scrollbars")), "toggled", G_CALLBACK (reset_scrollbars_toggled_cb), data); label = gtk_label_new (_("Viewer")); gtk_widget_show (label); gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); g_object_set_data_full (G_OBJECT (dialog), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free); }