~ubuntu-branches/debian/stretch/sensors-applet/stretch

« back to all changes in this revision

Viewing changes to sensors-applet/sensors-applet-plugins.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2011-11-05 14:53:12 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20111105145312-pce58z1ov0rc9moq
Tags: 3.0.0-0.1
* Non-maintainer upload.
* New upstream release, with support for GNOME3 Panel (closes: #638099).
* Drop link-to-libdl and libnotify_0.7_api_change patches, applied
  upstream.
* Drop dh_autoreconf and all bootstrap friends from Build-Depends and
  Build-Conflicts, not needed anymore.
* Update Build-Depends for the GTK+3 port, as per configure.ac.
* Drop .a and .la files (closes: #633257).
* Build-Depend on libsensors4 for kfreebsd again, as the package is now
* available on that architecture.
* Avoid hardcoding architecture names for libatamart-dev, and drop it
  entirely for libsensors4, as all architectures should be supported,
  even if the Hurd isn't available yet (closes: #634515).
* As libsensors-applet-plugin hasn't bumped its sonames but has at least
  got an ABI break (due to the switch to GTK+3), and given there are no
  external rdepends, avoid a library rename by bumping its shlibs and
  adding Breaks: sensor-applets (<< 3.0.0).
* Change install path for the applet binary, and remove obsolete dirs.
* Tighten sensors-applet dependency on libsensors-applet-plugin to
  (= ${binary:Version}), just in case.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
                                SensorsAppletPluginGetSensorValue get_value_fn;
47
47
 
48
48
                                plugin_file = g_strdup_printf("%s/%s", path, file);
49
 
                                g_debug("found %s in plugin directory", plugin_file);
50
49
                                if ((handle = dlopen(plugin_file, RTLD_NOW)) != NULL) {
 
50
                                        g_debug("dlopen()'d %s", plugin_file);
 
51
 
51
52
                                        
52
53
                                        if ((name_fn = dlsym(handle, "sensors_applet_plugin_name")) != NULL &&
53
54
                                            (init_fn = dlsym(handle, "sensors_applet_plugin_init")) != NULL &&
54
55
                                            (get_value_fn = dlsym(handle, "sensors_applet_plugin_get_sensor_value")) != NULL) {
55
56
                                                GList *sensors;
56
 
                                                g_debug("calling init function for plugin file %s", plugin_file);
 
57
                                                g_debug("initing plugin %s", name_fn());
57
58
                                                
58
59
                                                if ((sensors = init_fn()) != NULL) {
59
60
                                                        GList *sensor;
92
93
                                                        }
93
94
                                                        g_list_free(sensors);
94
95
                                                } else {
95
 
                                                        g_debug("plugin could not find any sensors");
 
96
                                                        g_debug("plugin %s could not find any sensors", name_fn());
96
97
                                                        if (g_hash_table_lookup(sensors_applet->required_plugins,
97
98
                                                                                name_fn()))
98
99
                                                        {
99
 
                                                                g_debug("plugin is required - registering even though no sensors detected");
100
 
                                                        g_debug("registering plugin %s", name_fn());
101
 
                                                        g_hash_table_insert(sensors_applet->plugins,
102
 
                                                                            g_strdup(name_fn()),
103
 
                                                                            get_value_fn);
 
100
                                                                g_debug("plugin %s required - registering even though no sensors detected", name_fn());
 
101
                                                                g_hash_table_insert(sensors_applet->plugins,
 
102
                                                                                    g_strdup(name_fn()),
 
103
                                                                                    get_value_fn);
104
104
                                                        } else {
105
 
                                                                g_debug("unloading plugin");
 
105
                                                                g_debug("unloading plugin %s", name_fn());
 
106
                                                                dlclose(handle);
106
107
                                                        }
107
108
                                                }
108
 
                                                
109
 
                                                                
110
 
 
111
109
                                        } else {
112
110
                                                g_debug("plugin file %s does not contain the required interface", plugin_file);
113
 
                                                if (dlclose(handle) != 0) {
114
 
                                                        g_debug("error closing plugin file %s", plugin_file);
115
 
                                                }
 
111
                                                dlclose(handle);
116
112
                                        }
117
 
                                } else {
118
 
                                        g_debug("Could not dlopen: %s: %s", plugin_file, dlerror());
119
113
                                }
120
114
                                g_free(plugin_file);
121
115
                        }
134
128
        
135
129
        if ((home = g_get_home_dir()) != NULL) {
136
130
                gchar *path;
137
 
                path = g_build_filename(home, 
 
131
                path = g_build_filename(home,
138
132
                                        SENSORS_APPLET_USER_PLUGIN_DIR,
139
133
                                        NULL);
140
134
                load_all_plugins(sensors_applet, path);