Added tooltip explaining why a setting is not available
authorJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 23 Sep 2014 07:55:31 +0000 (09:55 +0200)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Tue, 23 Sep 2014 07:55:31 +0000 (09:55 +0200)
src/glade/psensor-pref.glade
src/glade/sensor-edit.glade
src/main.c
src/ui_pref.c
src/ui_sensorpref.c

index 54b1ee1..868c682 100644 (file)
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes">Psensor has not been build with Unity Launcher support</property>
                     <property name="margin_left">4</property>
                     <property name="margin_right">4</property>
                     <property name="margin_top">4</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes">Psensor has not been build with NVCtrl support</property>
                     <property name="margin_left">14</property>
                     <property name="margin_right">4</property>
                     <property name="margin_top">4</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes">Psensor has not been build with ATI ADL support</property>
                     <property name="margin_left">14</property>
                     <property name="margin_right">4</property>
                     <property name="margin_top">4</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes">Psensor has not been build with gtop2 support</property>
                     <property name="margin_left">14</property>
                     <property name="margin_right">4</property>
                     <property name="margin_top">4</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes">Psensor has not been build with libatasmart support</property>
                     <property name="margin_left">14</property>
                     <property name="margin_right">4</property>
                     <property name="margin_top">4</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
+                    <property name="tooltip_text" translatable="yes">Psensor has not been build with udisks2 support</property>
                     <property name="margin_left">14</property>
                     <property name="margin_right">4</property>
                     <property name="margin_top">4</property>
index 167c9eb..ad7d7ce 100644 (file)
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Psensor has not been build with AppIndicator support</property>
                         <property name="margin_left">4</property>
                         <property name="margin_right">4</property>
                         <property name="margin_top">4</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
+                        <property name="tooltip_text" translatable="yes">Psensor has not been build with AppIndicator support</property>
                         <property name="margin_left">4</property>
                         <property name="margin_right">4</property>
                         <property name="margin_top">4</property>
index 7840485..461949f 100644 (file)
@@ -519,7 +519,7 @@ int main(int argc, char **argv)
        pthread_t thread;
        int optc, cmdok, opti, new_instance, ret;
        char *url = NULL;
-       GApplication *app;
+       GtkApplication *app;
 
        program_name = argv[0];
 
@@ -567,12 +567,12 @@ int main(int argc, char **argv)
 
        log_init();
 
-       app = g_application_new("wpitchoune.psensor", 0);
+       app = gtk_application_new("wpitchoune.psensor", G_APPLICATION_IS_SERVICE);
 
-       g_application_register(app, NULL, NULL);
+       printf("%d\n",g_application_register(G_APPLICATION(app), NULL, NULL));
 
-       if (!new_instance && g_application_get_is_remote(app)) {
-               g_application_activate(app);
+       if (!new_instance && g_application_get_is_remote(G_APPLICATION(app))) {
+               g_application_activate(G_APPLICATION(app));
                log_warn(_("A Psensor instance already exists."));
                exit(EXIT_SUCCESS);
        }
index 5494777..cae40f2 100644 (file)
@@ -144,6 +144,14 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
        gtk_toggle_button_set_active(w_enable_launcher_counter,
                                     !cfg->unity_launcher_count_disabled);
 
+#if !HAVE_APPINDICATOR && !HAVE_APPINDICATOR_029
+       gtk_widget_set_sensitive(GTK_WIDGET(w_enable_launcher_counter), FALSE);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_enable_launcher_counter), TRUE);
+#else
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_enable_launcher_counter),
+                                  FALSE);
+#endif
+
        w_smooth_curves = GTK_TOGGLE_BUTTON
                (gtk_builder_get_object(builder, "graph_smooth_curves"));
        gtk_toggle_button_set_active(w_smooth_curves,
@@ -185,6 +193,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
                                                           "nvctrl"));
 #if !HAVE_NVIDIA
        gtk_widget_set_sensitive(GTK_WIDGET(w_nvctrl), 0);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_nvctrl), TRUE);
+#else
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_nvctrl), FALSE);
 #endif
        gtk_toggle_button_set_active(w_nvctrl, config_is_nvctrl_enabled());
 
@@ -193,6 +204,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
                                                           "atiadlsdk"));
 #if !HAVE_LIBATIADL
        gtk_widget_set_sensitive(GTK_WIDGET(w_atiadlsdk), 0);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_atiadlsdk), TRUE);
+#else
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_atiadlsdk), FALSE);
 #endif
        gtk_toggle_button_set_active(w_atiadlsdk,
                                     config_is_atiadlsdk_enabled());
@@ -202,6 +216,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
                                                           "gtop2"));
 #if !HAVE_GTOP
        gtk_widget_set_sensitive(GTK_WIDGET(w_gtop2), 0);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_gtop2), TRUE);
+#else
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_gtop2), FALSE);
 #endif
        gtk_toggle_button_set_active(w_gtop2, config_is_gtop2_enabled());
 
@@ -216,6 +233,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
                                                           "libatasmart"));
 #if !HAVE_ATASMART
        gtk_widget_set_sensitive(GTK_WIDGET(w_libatasmart), 0);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_libatasmart), TRUE);
+#else
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_libatasmart), FALSE);
 #endif
        gtk_toggle_button_set_active(w_libatasmart,
                                     config_is_libatasmart_enabled());
@@ -225,6 +245,9 @@ void ui_pref_dialog_run(struct ui_psensor *ui)
                                                           "udisks2"));
 #if !HAVE_LIBUDISKS2
        gtk_widget_set_sensitive(GTK_WIDGET(w_udisks2), 0);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_udisks2), TRUE);
+#else
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_udisks2), FALSE);
 #endif
        gtk_toggle_button_set_active(w_udisks2, config_is_udisks2_enabled());
 
index 6ca0815..76a90ea 100644 (file)
@@ -290,6 +290,20 @@ update_pref(struct sensor_pref *p, struct config *cfg, GtkBuilder *builder)
        w_appindicator_label_enabled = GTK_TOGGLE_BUTTON
                (gtk_builder_get_object(builder, "indicator_label_checkbox"));
 
+
+#if !HAVE_APPINDICATOR && !HAVE_APPINDICATOR_029
+       gtk_widget_set_sensitive(GTK_WIDGET(w_appindicator_label_enabled),
+                                FALSE);
+       gtk_widget_set_sensitive(GTK_WIDGET(w_appindicator_enabled), FALSE);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_label_enabled),
+                                  TRUE);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_enabled), TRUE);
+#else
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_label_enabled),
+                                  FALSE);
+       gtk_widget_set_has_tooltip(GTK_WIDGET(w_appindicator_enabled), FALSE);
+#endif
+
        gtk_toggle_button_set_active(w_alarm, p->alarm_enabled);
        gtk_spin_button_set_value(w_high_threshold, p->alarm_high_threshold);
        gtk_spin_button_set_value(w_low_threshold, p->alarm_low_threshold);