From 7ae3d9b084ba057df6c6c8707b8db9d317262ebb Mon Sep 17 00:00:00 2001 From: Sean Davis Date: Tue, 4 Sep 2018 19:46:28 -0400 Subject: [PATCH 2/2] Preferences: Improve spacing --- panel-plugin/mount-plugin.c | 39 ++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/panel-plugin/mount-plugin.c b/panel-plugin/mount-plugin.c index bbec7d5..4884e92 100644 --- a/panel-plugin/mount-plugin.c +++ b/panel-plugin/mount-plugin.c @@ -711,11 +711,14 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) GtkWidget *_vbox, *_vbox2; GtkWidget *_hbox; GtkWidget *_notebook; + GtkSizeGroup *_size_group; t_mounter_dialog * md; gboolean set_active; TRACE ("enters mounter_create_options"); + _size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); + xfce_panel_plugin_block_menu (plugin); dlg = xfce_titled_dialog_new_with_buttons( @@ -727,9 +730,6 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dlg), _("Properties")); gtk_window_set_icon_name(GTK_WINDOW(dlg),"drive-harddisk"); - gtk_container_set_border_width (GTK_CONTAINER (dlg), 2); - - md = g_new0 (t_mounter_dialog, 1); md->mt = mt; @@ -740,13 +740,14 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) _notebook = gtk_notebook_new (); gtk_widget_show (_notebook); - gtk_container_set_border_width (GTK_CONTAINER(_notebook), BORDER); + gtk_container_set_border_width (GTK_CONTAINER(_notebook), 6); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET(_notebook), TRUE, TRUE, BORDER); /* --------------- General tab page ----------------------*/ _vbox = gtk_vbox_new (FALSE, BORDER); - gtk_container_set_border_width (GTK_CONTAINER(_vbox), BORDER); + gtk_container_set_border_width (GTK_CONTAINER(_vbox), 12); + gtk_box_set_spacing (GTK_BOX (_vbox), 6); gtk_widget_show (_vbox); /* Show "unmounted" message */ @@ -774,6 +775,7 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) _("You can specify a distinct icon to be displayed in the panel.")); _hbox = gtk_hbox_new (FALSE, BORDER); + gtk_box_set_spacing (GTK_BOX (_hbox), 12); gtk_widget_show (_hbox); gtk_container_add (GTK_CONTAINER(_eventbox), _hbox ); @@ -794,7 +796,7 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) /* --------------- Commands tab page ----------------------*/ _vbox = gtk_vbox_new (FALSE, BORDER); - gtk_container_set_border_width (GTK_CONTAINER(_vbox), BORDER); + gtk_container_set_border_width (GTK_CONTAINER(_vbox), 12); gtk_widget_show (_vbox); /* After-mount command */ @@ -809,13 +811,17 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) "'%d' can be used to specify the device, '%m' for the mountpoint.")); _hbox = gtk_hbox_new (FALSE, BORDER); + gtk_box_set_spacing (GTK_BOX (_hbox), 12); gtk_widget_show (_hbox); gtk_container_add (GTK_CONTAINER (_eventbox), _hbox); _label = gtk_label_new_with_mnemonic (_("_Execute after mounting:")); + gtk_label_set_xalign (GTK_LABEL (_label), 0.0f); gtk_widget_show (_label); gtk_box_pack_start (GTK_BOX (_hbox), _label, FALSE, FALSE, 0); + gtk_size_group_add_widget (_size_group, _label); + md->string_cmd = gtk_entry_new (); if (mt->on_mount_cmd != NULL) gtk_entry_set_text (GTK_ENTRY(md->string_cmd), @@ -825,7 +831,7 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) gtk_box_pack_start (GTK_BOX(_hbox), md->string_cmd, TRUE, TRUE, 0); /* Specify custom commands */ - _vbox2 = gtk_vbox_new (FALSE, BORDER); + _vbox2 = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (_vbox), GTK_WIDGET (_vbox2), FALSE, FALSE, 0); gtk_widget_show (_vbox2); @@ -845,6 +851,8 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) strcmp(mt->umount_command, DEFAULT_UMOUNT_COMMAND)!=0 ) ? TRUE : FALSE; + gtk_widget_set_margin_top (GTK_WIDGET (md->specify_commands), 6); + gtk_widget_show (md->specify_commands); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(md->specify_commands), set_active); @@ -863,15 +871,21 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) "'%d' is used to specify the device, '%m' for the mountpoint.")); md->box_mount_commands = gtk_grid_new (); + gtk_grid_set_row_spacing (GTK_GRID (md->box_mount_commands), 6); + gtk_grid_set_column_spacing (GTK_GRID (md->box_mount_commands), 12); gtk_container_add (GTK_CONTAINER (_eventbox), md->box_mount_commands); gtk_widget_show (md->box_mount_commands); _label = gtk_label_new_with_mnemonic (_("_Mount command:")); + gtk_label_set_xalign (GTK_LABEL (_label), 0.0f); gtk_widget_set_valign(_label,GTK_ALIGN_CENTER); gtk_widget_show (_label); gtk_grid_attach (GTK_GRID(md->box_mount_commands), _label, 0, 0, 1, 1); + gtk_size_group_add_widget (_size_group, _label); + _label = gtk_label_new_with_mnemonic (_("_Unmount command:")); + gtk_label_set_xalign (GTK_LABEL (_label), 0.0f); gtk_widget_set_valign(_label,GTK_ALIGN_CENTER); gtk_widget_show (_label); gtk_grid_attach (GTK_GRID(md->box_mount_commands), _label, 0, 1, 1, 1); @@ -881,17 +895,20 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) gtk_entry_set_text (GTK_ENTRY(md->string_mount_command ), g_strdup(mt->mount_command )); gtk_widget_show (md->string_mount_command ); + gtk_widget_set_hexpand (GTK_WIDGET (md->string_mount_command), TRUE); gtk_grid_attach (GTK_GRID(md->box_mount_commands), md->string_mount_command , 1, 0, 1, 1); + gtk_size_group_add_widget (_size_group, _label); + md->string_umount_command = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY(md->string_umount_command ), g_strdup(mt->umount_command )); gtk_widget_show (md->string_umount_command ); gtk_grid_attach (GTK_GRID(md->box_mount_commands), md->string_umount_command , 1, 1, - 2, 1); + 1, 1); if (!set_active) /* following command wasn't executed by signal handler! */ gtk_widget_set_sensitive ( md->box_mount_commands, FALSE ); @@ -901,8 +918,8 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) gtk_notebook_append_page (GTK_NOTEBOOK(_notebook), _vbox, _label); /* File systems tab page */ - _vbox = gtk_vbox_new (FALSE, BORDER); - gtk_container_set_border_width (GTK_CONTAINER(_vbox), BORDER); + _vbox = gtk_vbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER(_vbox), 12); gtk_widget_show (_vbox); /* show include_NFSs */ @@ -964,7 +981,7 @@ mounter_create_options (XfcePanelPlugin *plugin, t_mounter *mt) gtk_widget_show (_eventbox); gtk_widget_set_tooltip_text(_eventbox, _("Trim the device names to the number of characters specified in the spin button.")); - _hbox = gtk_hbox_new (FALSE, BORDER); + _hbox = gtk_hbox_new (FALSE, 12); gtk_widget_show (_hbox); gtk_container_add (GTK_CONTAINER (_eventbox), _hbox ); gtk_widget_set_sensitive(GTK_WIDGET(_hbox), !mt->exclude_devicenames); -- 2.17.1