Browse Source

issue 1135: Main frame should update icon in response to config changes

git-svn-id: http://svn.dmdirc.com/trunk@3902 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Gregory Holmes 16 years ago
parent
commit
bee924a4fd
1 changed files with 18 additions and 12 deletions
  1. 18
    12
      src/com/dmdirc/ui/swing/MainFrame.java

+ 18
- 12
src/com/dmdirc/ui/swing/MainFrame.java View File

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
-
23
 package com.dmdirc.ui.swing;
22
 package com.dmdirc.ui.swing;
24
 
23
 
25
 import com.dmdirc.FrameContainer;
24
 import com.dmdirc.FrameContainer;
97
      * direction. */
96
      * direction. */
98
     private int yOffset;
97
     private int yOffset;
99
     /** The main application icon. */
98
     /** The main application icon. */
100
-    private final ImageIcon imageIcon;
99
+    private ImageIcon imageIcon;
101
     /** The frame manager that's being used. */
100
     /** The frame manager that's being used. */
102
     private FrameManager mainFrameManager;
101
     private FrameManager mainFrameManager;
103
     /** Dekstop pane. */
102
     /** Dekstop pane. */
155
                 getOptionBool("ui", "showversion", false);
154
                 getOptionBool("ui", "showversion", false);
156
         IdentityManager.getGlobalConfig().
155
         IdentityManager.getGlobalConfig().
157
                 addChangeListener("ui", "showversion", this);
156
                 addChangeListener("ui", "showversion", this);
157
+        IdentityManager.getGlobalConfig().
158
+                addChangeListener("icon", "icon", this);
158
 
159
 
159
         //TODO: Remove me when we switch to java7
160
         //TODO: Remove me when we switch to java7
160
         addWindowFocusListener(new WindowFocusListener() {
161
         addWindowFocusListener(new WindowFocusListener() {
162
             /** {@inheritDoc} */
163
             /** {@inheritDoc} */
163
             @Override
164
             @Override
164
             public void windowGainedFocus(WindowEvent e) {
165
             public void windowGainedFocus(WindowEvent e) {
165
-            //Ignore
166
+                //Ignore
166
             }
167
             }
167
 
168
 
168
             /** {@inheritDoc} */
169
             /** {@inheritDoc} */
289
     /** {@inheritDoc}. */
290
     /** {@inheritDoc}. */
290
     @Override
291
     @Override
291
     public void windowOpened(final WindowEvent windowEvent) {
292
     public void windowOpened(final WindowEvent windowEvent) {
292
-    //ignore
293
+        //ignore
293
     }
294
     }
294
 
295
 
295
     /** {@inheritDoc} */
296
     /** {@inheritDoc} */
301
     /** {@inheritDoc}. */
302
     /** {@inheritDoc}. */
302
     @Override
303
     @Override
303
     public void windowClosed(final WindowEvent windowEvent) {
304
     public void windowClosed(final WindowEvent windowEvent) {
304
-    //ignore
305
+        //ignore
305
     }
306
     }
306
 
307
 
307
     /** {@inheritDoc}. */
308
     /** {@inheritDoc}. */
319
     /** {@inheritDoc}. */
320
     /** {@inheritDoc}. */
320
     @Override
321
     @Override
321
     public void windowActivated(final WindowEvent windowEvent) {
322
     public void windowActivated(final WindowEvent windowEvent) {
322
-    //ignore
323
+        //ignore
323
     }
324
     }
324
 
325
 
325
     /** {@inheritDoc}. */
326
     /** {@inheritDoc}. */
326
     @Override
327
     @Override
327
     public void windowDeactivated(final WindowEvent windowEvent) {
328
     public void windowDeactivated(final WindowEvent windowEvent) {
328
-    //ignore
329
+        //ignore
329
     }
330
     }
330
 
331
 
331
     /** Initialiases the frame managers. */
332
     /** Initialiases the frame managers. */
572
     /** {@inheritDoc} */
573
     /** {@inheritDoc} */
573
     @Override
574
     @Override
574
     public void configChanged(final String domain, final String key) {
575
     public void configChanged(final String domain, final String key) {
575
-        showVersion =
576
-                IdentityManager.getGlobalConfig().
577
-                getOptionBool("ui", "showversion", false);
576
+        if ("ui".equals(domain)) {
577
+            showVersion =
578
+                    IdentityManager.getGlobalConfig().
579
+                    getOptionBool("ui", "showversion", false);
580
+        } else {
581
+            imageIcon =
582
+                    new ImageIcon(IconManager.getIconManager().getImage("icon"));
583
+            setIconImage(imageIcon.getImage());
584
+        }
578
     }
585
     }
579
 
586
 
580
     /** {@inheritDoc}. */
587
     /** {@inheritDoc}. */
581
     @Override
588
     @Override
582
     public void setParent(final JComponent parent) {
589
     public void setParent(final JComponent parent) {
583
-    //Ignore
590
+        //Ignore
584
     }
591
     }
585
 
592
 
586
     /** {@inheritDoc}. */
593
     /** {@inheritDoc}. */
651
     public void delWindow(final FrameContainer parent, final FrameContainer window) {
658
     public void delWindow(final FrameContainer parent, final FrameContainer window) {
652
         delWindow(window);
659
         delWindow(window);
653
     }
660
     }
654
-
655
 }
661
 }

Loading…
Cancel
Save