file-browser-messages: Clean up formatting

This commit is contained in:
JosephMcc 2017-02-13 15:02:25 -08:00
parent 372399891d
commit fe9e6ac91c
1 changed files with 263 additions and 249 deletions

View File

@ -92,7 +92,9 @@ window_data_free (XedWindow *window)
gtk_ui_manager_remove_action_group (manager, data->merged_actions); gtk_ui_manager_remove_action_group (manager, data->merged_actions);
for (item = data->merge_ids; item; item = item->next) for (item = data->merge_ids; item; item = item->next)
{
gtk_ui_manager_remove_ui (manager, GPOINTER_TO_INT (item->data)); gtk_ui_manager_remove_ui (manager, GPOINTER_TO_INT (item->data));
}
g_list_free (data->merge_ids); g_list_free (data->merge_ids);
g_object_unref (data->merged_actions); g_object_unref (data->merged_actions);
@ -115,10 +117,8 @@ filter_data_new (XedWindow *window,
wdata = get_window_data (window); wdata = get_window_data (window);
g_hash_table_insert (wdata->filters, g_hash_table_insert (wdata->filters, xed_message_type_identifier (xed_message_get_object_path (message),
xed_message_type_identifier (xed_message_get_object_path (message), xed_message_get_method (message)), data);
xed_message_get_method (message)),
data);
return data; return data;
} }
@ -148,7 +148,9 @@ track_row_lookup (WindowData *data,
ref = (GtkTreeRowReference *)g_hash_table_lookup (data->row_tracking, id); ref = (GtkTreeRowReference *)g_hash_table_lookup (data->row_tracking, id);
if (!ref) if (!ref)
{
return NULL; return NULL;
}
return gtk_tree_row_reference_get_path (ref); return gtk_tree_row_reference_get_path (ref);
} }
@ -201,15 +203,23 @@ message_set_root_cb (XedMessageBus *bus,
xed_message_get (message, "location", &root, NULL); xed_message_get (message, "location", &root, NULL);
if (!root) if (!root)
{
return; return;
}
if (xed_message_has_key (message, "virtual")) if (xed_message_has_key (message, "virtual"))
{
xed_message_get (message, "virtual", &virtual, NULL); xed_message_get (message, "virtual", &virtual, NULL);
}
if (virtual) if (virtual)
{
xed_file_browser_widget_set_root_and_virtual_root (data->widget, root, virtual); xed_file_browser_widget_set_root_and_virtual_root (data->widget, root, virtual);
}
else else
{
xed_file_browser_widget_set_root (data->widget, root, TRUE); xed_file_browser_widget_set_root (data->widget, root, TRUE);
}
} }
static void static void
@ -239,11 +249,7 @@ message_set_emblem_cb (XedMessageBus *bus,
GError *error = NULL; GError *error = NULL;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), emblem, 10, 0, &error);
emblem,
10,
0,
&error);
if (pixbuf) if (pixbuf)
{ {
@ -257,10 +263,7 @@ message_set_emblem_cb (XedMessageBus *bus,
g_value_init (&value, GDK_TYPE_PIXBUF); g_value_init (&value, GDK_TYPE_PIXBUF);
g_value_set_object (&value, pixbuf); g_value_set_object (&value, pixbuf);
xed_file_browser_store_set_value (store, xed_file_browser_store_set_value (store, &iter, XED_FILE_BROWSER_STORE_COLUMN_EMBLEM, &value);
&iter,
XED_FILE_BROWSER_STORE_COLUMN_EMBLEM,
&value);
g_value_unset (&value); g_value_unset (&value);
} }
@ -330,23 +333,24 @@ set_item_message (WindowData *data,
-1); -1);
if (!location) if (!location)
{
return; return;
}
if (path && gtk_tree_path_get_depth (path) != 0) if (path && gtk_tree_path_get_depth (path) != 0)
{
track_id = track_row (data, store, path, location); track_id = track_row (data, store, path, location);
}
else else
{
track_id = NULL; track_id = NULL;
}
xed_message_set (message, xed_message_set (message, "id", track_id, "location", location, NULL);
"id", track_id,
"location", location,
NULL);
if (xed_message_has_key (message, "is_directory")) if (xed_message_has_key (message, "is_directory"))
{ {
xed_message_set (message, xed_message_set (message, "is_directory", FILE_IS_DIR (flags), NULL);
"is_directory", FILE_IS_DIR (flags),
NULL);
} }
g_free (track_id); g_free (track_id);
@ -399,10 +403,7 @@ message_add_filter_cb (XedMessageBus *bus,
FilterData *filter_data; FilterData *filter_data;
WindowData *data = get_window_data (window); WindowData *data = get_window_data (window);
xed_message_get (message, xed_message_get (message, "object_path", &object_path, "method", &method, NULL);
"object_path", &object_path,
"method", &method,
NULL);
// Check if there exists such a 'callback' message // Check if there exists such a 'callback' message
if (!object_path || !method) if (!object_path || !method)
@ -459,7 +460,9 @@ message_remove_filter_cb (XedMessageBus *bus,
xed_message_get (message, "id", &id, NULL); xed_message_get (message, "id", &id, NULL);
if (!id) if (!id)
{
return; return;
}
xed_file_browser_widget_remove_filter (data->widget, id); xed_file_browser_widget_remove_filter (data->widget, id);
} }
@ -513,9 +516,13 @@ message_set_show_hidden_cb (XedMessageBus *bus,
mode = xed_file_browser_store_get_filter_mode (store); mode = xed_file_browser_store_get_filter_mode (store);
if (active) if (active)
{
mode &= ~XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN; mode &= ~XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN;
}
else else
{
mode |= XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN; mode |= XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN;
}
xed_file_browser_store_set_filter_mode (store, mode); xed_file_browser_store_set_filter_mode (store, mode);
} }
@ -535,9 +542,13 @@ message_set_show_binary_cb (XedMessageBus *bus,
mode = xed_file_browser_store_get_filter_mode (store); mode = xed_file_browser_store_get_filter_mode (store);
if (active) if (active)
{
mode &= ~XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY; mode &= ~XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY;
}
else else
{
mode |= XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY; mode |= XED_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY;
}
xed_file_browser_store_set_filter_mode (store, mode); xed_file_browser_store_set_filter_mode (store, mode);
} }
@ -569,15 +580,14 @@ message_add_context_item_cb (XedMessageBus *bus,
GtkUIManager *manager; GtkUIManager *manager;
guint merge_id; guint merge_id;
xed_message_get (message, xed_message_get (message, "action", &action, "path", &path, NULL);
"action", &action,
"path", &path,
NULL);
if (!action || !path) if (!action || !path)
{ {
if (action) if (action)
{
g_object_unref (action); g_object_unref (action);
}
g_free (path); g_free (path);
return; return;
@ -622,7 +632,9 @@ message_remove_context_item_cb (XedMessageBus *bus,
xed_message_get (message, "id", &merge_id, NULL); xed_message_get (message, "id", &merge_id, NULL);
if (merge_id == 0) if (merge_id == 0)
{
return; return;
}
manager = xed_file_browser_widget_get_ui_manager (data->widget); manager = xed_file_browser_widget_get_ui_manager (data->widget);
@ -778,7 +790,9 @@ store_row_deleted (XedFileBrowserStore *store,
guint flags = 0; guint flags = 0;
if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path)) if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path))
{
return; return;
}
gtk_tree_model_get (GTK_TREE_MODEL (store), &iter, gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags, XED_FILE_BROWSER_STORE_COLUMN_FLAGS, &flags,
@ -804,11 +818,11 @@ store_virtual_root_changed (XedFileBrowserStore *store,
vroot = xed_file_browser_store_get_virtual_root (store); vroot = xed_file_browser_store_get_virtual_root (store);
if (!vroot) if (!vroot)
{
return; return;
}
xed_message_set (data->message, xed_message_set (data->message, "location", vroot, NULL);
"location", vroot,
NULL);
xed_message_bus_send_message_sync (wdata->bus, data->message); xed_message_bus_send_message_sync (wdata->bus, data->message);
@ -981,7 +995,9 @@ message_unregistered (XedMessageBus *bus,
data = g_hash_table_lookup (wdata->filters, identifier); data = g_hash_table_lookup (wdata->filters, identifier);
if (data) if (data)
{
xed_file_browser_widget_remove_filter (wdata->widget, data->id); xed_file_browser_widget_remove_filter (wdata->widget, data->id);
}
g_free (identifier); g_free (identifier);
} }
@ -995,10 +1011,8 @@ xed_file_browser_messages_register (XedWindow *window,
register_methods (window, widget); register_methods (window, widget);
register_signals (window, widget); register_signals (window, widget);
g_signal_connect (xed_window_get_message_bus (window), g_signal_connect (xed_window_get_message_bus (window), "unregistered",
"unregistered", G_CALLBACK (message_unregistered), window);
G_CALLBACK (message_unregistered),
window);
} }
static void static void