From 203399fc4969ea512c96592ec6a22218015f4fbd Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Sat, 9 Mar 2019 15:26:57 +0100 Subject: drop functions defined but not used --- src/caja-application.c | 224 ------------------------------------- src/caja-information-panel.c | 156 -------------------------- src/caja-main.c | 14 --- src/caja-navigation-window-menus.c | 10 -- src/caja-notebook.c | 19 ---- src/caja-window.c | 40 ------- 6 files changed, 463 deletions(-) (limited to 'src') diff --git a/src/caja-application.c b/src/caja-application.c index 85285304..62873184 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -618,183 +618,6 @@ automount_all_volumes_idle_cb (gpointer data) return FALSE; } -static void -check_volume_queue (CajaApplication *application) -{ - GList *l, *next; - GVolume *volume; - - l = application->volume_queue; - - if (application->screensaver_active) - { - return; - } - - while (l != NULL) { - volume = l->data; - next = l->next; - - caja_file_operations_mount_volume (NULL, volume, TRUE); - application->volume_queue = - g_list_remove (application->volume_queue, volume); - - g_object_unref (volume); - l = next; - } - - application->volume_queue = NULL; -} - -#define SCREENSAVER_NAME "org.mate.ScreenSaver" -#define SCREENSAVER_PATH "/org/mate/ScreenSaver" -#define SCREENSAVER_INTERFACE "org.mate.ScreenSaver" - -static void -screensaver_signal_callback (GDBusProxy *proxy, - const gchar *sender_name, - const gchar *signal_name, - GVariant *parameters, - gpointer user_data) -{ - CajaApplication *application = user_data; - - if (g_strcmp0 (signal_name, "ActiveChanged") == 0) - { - g_variant_get (parameters, "(b)", &application->screensaver_active); - g_debug ("Screensaver active changed to %d", application->screensaver_active); - - check_volume_queue (application); - } -} - -static void -screensaver_get_active_ready_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) -{ - CajaApplication *application = user_data; - GDBusProxy *proxy = application->ss_proxy; - GVariant *result; - GError *error = NULL; - - result = g_dbus_proxy_call_finish (proxy, - res, - &error); - - if (error != NULL) { - g_warning ("Can't call GetActive() on the ScreenSaver object: %s", - error->message); - g_error_free (error); - - return; - } - - g_variant_get (result, "(b)", &application->screensaver_active); - g_variant_unref (result); - - g_debug ("Screensaver GetActive() returned %d", application->screensaver_active); -} - -static void -screensaver_proxy_ready_cb (GObject *source, - GAsyncResult *res, - gpointer user_data) -{ - CajaApplication *application = user_data; - GError *error = NULL; - GDBusProxy *ss_proxy; - - ss_proxy = g_dbus_proxy_new_finish (res, &error); - - if (error != NULL) - { - g_warning ("Can't get proxy for the ScreenSaver object: %s", - error->message); - g_error_free (error); - - return; - } - - g_debug ("ScreenSaver proxy ready"); - - application->ss_proxy = ss_proxy; - - g_signal_connect (ss_proxy, "g-signal", - G_CALLBACK (screensaver_signal_callback), application); - - g_dbus_proxy_call (ss_proxy, - "GetActive", - NULL, - G_DBUS_CALL_FLAGS_NO_AUTO_START, - -1, - NULL, - screensaver_get_active_ready_cb, - application); -} - -static void -screensaver_appeared_callback (GDBusConnection *connection, - const gchar *name, - const gchar *name_owner, - gpointer user_data) -{ - CajaApplication *application = user_data; - - g_debug ("ScreenSaver name appeared"); - - application->screensaver_active = FALSE; - - g_dbus_proxy_new (connection, - G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, - NULL, - name, - SCREENSAVER_PATH, - SCREENSAVER_INTERFACE, - NULL, - screensaver_proxy_ready_cb, - application); -} - -static void -screensaver_vanished_callback (GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - CajaApplication *application = user_data; - - g_debug ("ScreenSaver name vanished"); - - application->screensaver_active = FALSE; - if (application->ss_proxy != NULL) - { - g_object_unref (application->ss_proxy); - application->ss_proxy = NULL; - } - - /* in this case force a clear of the volume queue, without - * mounting them. - */ - if (application->volume_queue != NULL) - { - g_list_free_full (application->volume_queue, g_object_unref); - application->volume_queue = NULL; - } -} - -static void -do_initialize_screensaver (CajaApplication *application) -{ - application->ss_watch_id = - g_bus_watch_name (G_BUS_TYPE_SESSION, - SCREENSAVER_NAME, - G_BUS_NAME_WATCHER_FLAGS_NONE, - screensaver_appeared_callback, - screensaver_vanished_callback, - application, - NULL); -} - static void selection_get_cb (GtkWidget *widget, GtkSelectionData *selection_data, @@ -1547,53 +1370,6 @@ mount_removed_callback (GVolumeMonitor *monitor, g_list_free (close_list); } -static char * -icon_to_string (GIcon *icon) -{ - const char * const *names; - GFile *file; - - if (icon == NULL) - { - return NULL; - } - else if (G_IS_THEMED_ICON (icon)) - { - names = g_themed_icon_get_names (G_THEMED_ICON (icon)); - return g_strjoinv (":", (char **)names); - } - else if (G_IS_FILE_ICON (icon)) - { - file = g_file_icon_get_file (G_FILE_ICON (icon)); - return g_file_get_path (file); - } - return NULL; -} - -static GIcon * -icon_from_string (const char *string) -{ - GFile *file; - GIcon *icon; - gchar **names; - - if (g_path_is_absolute (string)) - { - file = g_file_new_for_path (string); - icon = g_file_icon_new (file); - g_object_unref (file); - return icon; - } - else - { - names = g_strsplit (string, ":", 0); - icon = g_themed_icon_new_from_names (names, -1); - g_strfreev (names); - return icon; - } - return NULL; -} - static char * caja_application_get_session_data (CajaApplication *self) { diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index e1d0fe73..2beae1c9 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -698,162 +698,6 @@ caja_information_panel_press_event (GtkWidget *widget, GdkEventButton *event) return TRUE; } -static gboolean -value_different (const char *a, const char *b) -{ - if (!a && !b) - return FALSE; - - if (!a || !b) - return TRUE; - - return strcmp (a, b); -} - -/* Handle the background changed signal by writing out the settings to metadata. - */ -static void -background_settings_changed_callback (EelBackground *background, GdkDragAction action, CajaInformationPanel *information_panel) -{ - char *image; - char *color; - - g_assert (EEL_IS_BACKGROUND (background)); - g_assert (CAJA_IS_INFORMATION_PANEL (information_panel)); - - if (information_panel->details->file == NULL) - { - return; - } - - /* Block so we don't respond to our own metadata changes. - */ - g_signal_handlers_block_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); - - color = eel_background_get_color (background); - image = eel_background_get_image_uri (background); - - if (action != (GdkDragAction) CAJA_DND_ACTION_SET_AS_BACKGROUND) - { - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL, - NULL); - - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL, - NULL); - - g_signal_handlers_block_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - g_settings_set_string (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, color ? color : ""); - g_settings_set_string (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_URI, image ? image : ""); - g_settings_set_boolean (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, TRUE); - g_signal_handlers_unblock_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - } - else - { - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL, - color); - - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL, - image); - } - - if (value_different (information_panel->details->current_background_color, color)) - { - g_free (information_panel->details->current_background_color); - information_panel->details->current_background_color = g_strdup (color); - } - - if (value_different (information_panel->details->current_background_image, image)) - { - g_free (information_panel->details->current_background_image); - information_panel->details->current_background_image = g_strdup (image); - } - - g_free (color); - g_free (image); - - g_signal_handlers_unblock_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); -} - -/* handle the background reset signal by writing out NULL to metadata and setting the backgrounds - fields to their default values */ -static void -background_reset_callback (EelBackground *background, CajaInformationPanel *information_panel) -{ - char *color; - char *image; - g_assert (EEL_IS_BACKGROUND (background)); - g_assert (CAJA_IS_INFORMATION_PANEL (information_panel)); - - if (information_panel->details->file == NULL) - { - return; - } - - /* Block so we don't respond to our own metadata changes. - */ - g_signal_handlers_block_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); - - color = caja_file_get_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL); - - image = caja_file_get_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL); - if (color || image) - { - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_COLOR, - NULL, - NULL); - - caja_file_set_metadata (information_panel->details->file, - CAJA_METADATA_KEY_SIDEBAR_BACKGROUND_IMAGE, - NULL, - NULL); - } - else - { - g_signal_handlers_block_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - g_settings_set_boolean (caja_preferences, - CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, FALSE); - g_signal_handlers_unblock_by_func (caja_preferences, - G_CALLBACK(caja_information_panel_theme_changed), - information_panel); - } - - g_signal_handlers_unblock_by_func (information_panel->details->file, - G_CALLBACK (background_metadata_changed_callback), - information_panel); - - /* Force a read from the metadata to set the defaults - */ - background_metadata_changed_callback (information_panel); -} - static GtkWindow * caja_information_panel_get_window (CajaInformationPanel *information_panel) { diff --git a/src/caja-main.c b/src/caja-main.c index 10914246..8d6c24dd 100644 --- a/src/caja-main.c +++ b/src/caja-main.c @@ -219,20 +219,6 @@ setup_debug_log (void) setup_debug_log_glog (); } -static gboolean -running_in_mate (void) -{ - return (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "MATE") == 0) - || (g_strcmp0 (g_getenv ("XDG_SESSION_DESKTOP"), "mate") == 0) - || (g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "mate") == 0); -} - -static gboolean -running_as_root (void) -{ - return geteuid () == 0; -} - int main (int argc, char *argv[]) { diff --git a/src/caja-navigation-window-menus.c b/src/caja-navigation-window-menus.c index 0769119c..e9d822c0 100644 --- a/src/caja-navigation-window-menus.c +++ b/src/caja-navigation-window-menus.c @@ -436,16 +436,6 @@ connect_proxy_cb (GtkActionGroup *action_group, gtk_label_set_max_width_chars (label, MENU_ITEM_MAX_WIDTH_CHARS); } -static const char* icon_entries[] = -{ - "/MenuBar/Other Menus/Go/Home", - "/MenuBar/Other Menus/Go/Computer", - "/MenuBar/Other Menus/Go/Go to Templates", - "/MenuBar/Other Menus/Go/Go to Trash", - "/MenuBar/Other Menus/Go/Go to Network", - "/MenuBar/Other Menus/Go/Go to Location" -}; - /** * refresh_go_menu: * diff --git a/src/caja-notebook.c b/src/caja-notebook.c index 8bdaab8e..ac6727f4 100644 --- a/src/caja-notebook.c +++ b/src/caja-notebook.c @@ -51,12 +51,6 @@ static int caja_notebook_insert_page (GtkNotebook *notebook, static void caja_notebook_remove (GtkContainer *container, GtkWidget *tab_widget); -static const GtkTargetEntry url_drag_types[] = -{ - { CAJA_ICON_DND_MATE_ICON_LIST_TYPE, 0, CAJA_ICON_DND_MATE_ICON_LIST }, - { CAJA_ICON_DND_URI_LIST_TYPE, 0, CAJA_ICON_DND_URI_LIST }, -}; - enum { TAB_CLOSE_REQUEST, @@ -183,19 +177,6 @@ caja_notebook_init (CajaNotebook *notebook) g_signal_connect (notebook, "button-press-event", (GCallback)button_press_cb, NULL); - - /* Set up drag-and-drop target */ - /* TODO this would be used for opening a new tab. - * It will only work properly as soon as GtkNotebook - * supports to find out whether a particular point - * is on a tab button or not. - */ -#if 0 - gtk_drag_dest_set (GTK_WIDGET (notebook), 0, - url_drag_types, G_N_ELEMENTS (url_drag_types), - GDK_ACTION_LINK); - gtk_drag_dest_set_track_motion (GTK_WIDGET (notebook), TRUE); -#endif } void diff --git a/src/caja-window.c b/src/caja-window.c index 5f29cbbe..c95870f9 100644 --- a/src/caja-window.c +++ b/src/caja-window.c @@ -983,46 +983,6 @@ caja_window_slot_close (CajaWindowSlot *slot) caja_window_pane_slot_close (slot->pane, slot); } -static void -caja_window_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - GdkScreen *screen; - guint max_width; - guint max_height; - - g_assert (CAJA_IS_WINDOW (widget)); - g_assert (requisition != NULL); - - screen = gtk_window_get_screen (GTK_WINDOW (widget)); - - /* Limit the requisition to be within 90% of the available screen - * real state. - * - * This way the user will have a fighting chance of getting - * control of their window back if for whatever reason one of the - * window's descendants decide they want to be 4000 pixels wide. - * - * Note that the user can still make the window really huge by hand. - * - * Bugs in components or other widgets that cause such huge geometries - * to be requested, should still be fixed. This code is here only to - * prevent the extremely frustrating consequence of such bugs. - */ - max_width = get_max_forced_width (screen); - max_height = get_max_forced_height (screen); - - if (requisition->width > (int) max_width) - { - requisition->width = max_width; - } - - if (requisition->height > (int) max_height) - { - requisition->height = max_height; - } -} - static void caja_window_realize (GtkWidget *widget) { -- cgit v1.2.1